In which we get started on the Products section by building out the data structures and entering test content.
As you, the intrepid reader, have already guessed by reading the title of this article, this is the 8th installment in the Building an ExpressionEngine Site series. In Chapter 7 we wrapped up the About section of our sample website. In this chapter we get started on the section of the site that will have the most meat to it—the Products section.
Just to make this interesting, let’s imagine that our company has enough products to be categorized. This section of the site should function in a pretty typical manner - with a Products index page that shows listings for categories only. Each category listing will have an image, description, and a link to a category page that will show the products in that category. Clicking a product link will load a product-specific page will all the data for that product.
Let’s build the backend EE structures that we’ll need to power this section. We need a new:
Create the Products Weblog
By this point—if you’ve been following along - you’ve already created a couple of weblogs so I’m going to gloss over the specific steps. If you need a refresher you can re-visit Chapter 4. I’m going to create mine with a name of “Building Series Products” and a short name of “bees_products”. I went through the preferences and turned off the options that generate the trackback related code.
Create the Field Group
Products typically have a more involved data structure than content pages like the Home and About pages - so we’ll have to create a new field group to hold some new product-specific fields. The specific steps to creating a new field group are also back in Chapter 4. I’ve named mine “bees_products”.
Fill out the Fieldset
Add the following 7 fields to your new custom field group. Indicated with each field is the name, display name, field type, field formatting, and if it’s searchable or not. I just left defaults for everything else:
Create the Category Group
This is new territory - the first time we’re going to use categories on this site. The process is much the same as the field group, where first we create the group then populate the group with specific categories. Here are the specific steps:
Add Categories
Here again is where EE prompts you to assign the new group to a weblog. I prefer to add the categories in first, then go back and assign both the new category group and new field group to the new weblog. To add categories:
Connect the Weblog, Category Group and Field Group
Now that we have our structures created we need to asscociate them in EE:
Enter Content
If you click the “Publish” tab and choose your new Products weblog, you should get a content entry screen with your new custom fields. Clicking the “Categories” tab should bring up your new Categories. If these two things aren’t true for you, go back through the previous paragraph and make sure you’ve connected the Weblog, Category Group and Field Group in the “Edit Groups” option for the Weblog.
If everything looks good, enter in some test content— it’s much easier to develop templates when there is content to return. If you’re not feeling creative you can use “Greeking” here—which is just placeholder text for design and programming purposes. I’ll often go to a site like http://www.lipsum.com/ and use it to generate paragraphs of Greeking text.
Photos
Each entry will need two photos - a thumbnail and a large image. The thumbnails will get used on the category index pages and the large images on the product-specific page. EE will create thumbnails for you when uploading a large image, but in this case I want them in separate fields for greater flexibility, so I’m creating my own thumbs locally.
I’m using thumbnails that are all the same size—150px by 122px. My large images are 500px by 375px. When uploading EE will give you the option of Embedded in Entry, URL Only, or Pop-up Image Link. For this tutorial choose “URL Only” as this will let us specify more of the HTML for the image in the template (like using the entry title for alt and title text).
Make sure to enter at least 1 and ideally 2-3 products in each category. One product can be assigned to more than one category.
Wrapping Up
I don’t have a finished page to show so it doesn’t feel like we made a ton of progress in this chapter, but getting the data structures in place is a necessary first step to the build-out of any new section. This is a good place to break, and in the next chapter we’ll start in on the templates that will pull our new content out.
On to Chapter 9.
Back to Chapter 7.
Visit Train-ee.com for the latest in ExpressionEngine training designed with one goal in mind - to get you up to speed on ExpressionEngine® as quickly as possible.
The latest Train-ee Products:
The latest from the Train-ee blog:
October 01, 2007
Thank you! Your ExpressionEngine tutorials are the missing link that the EE docs/forums/wiki do not provide. These posts are much appreciated!
October 01, 2007
Thanks again Michael B..
These tutorials will prove ultimately useful, when I build out a theme of my own. All of the how-to steps are an immense time-saver.
November 02, 2007
Hi Michael,
Just want to thank you so much from the perspective of a designer/CSS coder that hasn’t been able to get over the CMS hurdle until now. It’s unusual for coders like yourself to do something like this.
I choose EE due to references from the likes of Mark Boulton and Veerle. I love how it generates strict XHTML and with your hands-on tutorials, gradually the light goes on for me. My goal has been ever since mastering CSS to offer clients a CMS to go with sites I create for them and now the day approaches much sooner thanks again to your labor of love here.
I’m sure Ellis Labs runs a thin staff and doesn’t have the budget for a tutorial for the likes of what you have here.
Again, thank you very much.
January 15, 2008
FYI: The Building an ExpressionEngine Site series is now available for purchase as an eBook on the newly-launched Train-ee.com.
February 10, 2008
I can’t quite quite figure out how to assign posts to a category. I’m sure I’ve missed something. I click “publish” and have successfully added several new posts, but how do I know which category I am assigning it to? When I click the “category” tab, all of the categories are there. I have connected the weblog, category group and field group. Also, how do I assign a product to more than one category?
Thanks for the help. This is a great tutorial. It is all beginning to make sense.
February 10, 2008
Hi Bill - there is a categories tab on the publish form. Select multiples by shift-clicking.
If the categories tab shows but no categories, then the category group didnt get assigned to the weblog.
February 10, 2008
Thanks. It’s that simple. I reviewed your tutorial, but couldn’t find it.
By the way. I just bought your book. It was the least I could do for this great tutorial you have provided.
One of the posts mentioned you for the Nobel Peace Prize (I agree with your comment about Al Gore.)
I’ve elevated you in the Mother Teresa/Ghandi category anyway.