>
>

Products Grouped In Categories

With regular products on a page, all products that are assigned to a page will be looped in the same section on your category page. However, some merchants may want to divide their products out into categories. For example, if you are a media store and have both BluRays and DVDs in the same category. You may want to separate these out into two categories on your page so that the DVDs are in one section and the BluRays are in another section. There is a way to do this within ShopSite with a custom template and by utilizing the extra page and product fields.

For this example, the first thing that you need to do is devote one extra product field (such as the extra product field 1) to the type of product that it is. I would suggest using the plural form of the word. It is also important that all products you want in the same category have exactly the same text in the product field. So, in my example, all BluRays will have "BluRays" in the extra product field 1. All DVDs will have "DVDs" in the extra product field 1.

Next, in your page template, determine the maximum number of categories that you will have on one page. In my media store example, I may have three categories at the max, DVDs, BluRays, and CDs. Since I will have a max of 3 categories of products, I will go to Preferences > Extra Fields, and make sure that I am displaying at least three extra page fields.

You now need to add this functionality to your custom template. I would suggest having two copies of your page template; one copy for regular category pages which list all products, and one copy for pages which divide products into categories. In the copy that you have which will divide products into categories, you can add the code below in place of LOOP PRODUCT tags.

[-- IF PAGE.Field1 --]
[-- VAR.Type PAGE.Field1 --]
[-- VAR.ColumnCount 0 --]

[-- VAR.Type --]

[-- LOOP PRODUCTS --]
[-- PRODUCT Generic-Category --]
[-- END_LOOP PRODUCTS --]
[-- END_IF --]

Now, you will want to repeat this code to match the maximum number of categories that you will have. So for my example, I have a max of three categories, so I will want to repeat this section of code 3 times on my page. Each time you repeat the code from above in your template, you will want to change the field number to a new field number. I am going to use three page fields, extra page field 1, 2 and 3. So the code in my template will look like this:

[-- IF PAGE.Field1 --]
[-- VAR.Type PAGE.Field1 --]

[-- VAR.Type --]

[-- LOOP PRODUCTS --]
[-- PRODUCT Generic-Category --]
[-- END_LOOP PRODUCTS --]
[-- END_IF --] [-- IF PAGE.Field2 --] [-- VAR.Type PAGE.Field2 --]

[-- VAR.Type --]

[-- LOOP PRODUCTS --] [-- PRODUCT Generic-Category --] [-- END_LOOP PRODUCTS --]
[-- END_IF --] [-- IF PAGE.Field3 --] [-- VAR.Type PAGE.Field3 --]

[-- VAR.Type --]

[-- LOOP PRODUCTS --] [-- PRODUCT Generic-Category --] [-- END_LOOP PRODUCTS --]
[-- END_IF --]

Next, you will want to setup your product template. Go to Merchandising > Custom Templates > Page/Product > New Product Template, and name your new product template Generic-Category. Click to edit that template, and within the DEFINE PRODUCT and END_DEFINE PRODUCT tags, you will want to add the following code. Note, you will want to go back in at a later time and add in the code for the more information page section of this template.

[-- IF PRODUCT.Field1 VAR.Type --]
[-- IF PRODUCT.Graphic --]
    [-- IF PRODUCT.DisplayGraphic --]
        [-- IF PRODUCT.DisplayMoreInformationPage --]
            [-- PRODUCT.Graphic --]
        [-- ELSE --]
            [-- PRODUCT.Graphic --]
        [-- END_IF --]
    [-- END_IF --]
[-- END_IF --]
[-- IF PRODUCT.DisplayName --]
    [-- IF PRODUCT.DisplayMoreInformationPage --]
        [-- PRODUCT.Name --]
    [-- ELSE --]
        [-- PRODUCT.Name --]
    [-- END_IF --]
[-- END_IF --]

[-- IF PRODUCT.ProductDescription --]
[-- PRODUCT.ProductDescription --]
[-- END_IF --]
[-- STORE.OrderQuantity --]
[-- IF ADDIMAGE? --] [-- ELSE --] [-- END_IF --]
[-- END_IF --]

Last, you need to know how to use this template. When setting up categories of products, you can enter the names of the categories that you want in your extra page fields. You can then assign products to your page. Of the products that are assigned to your page, only the products whose extra product field 1 exactly matches the page field will be displayed. So for my example, in my DVDs section, only products who have "DVDs" in their extra product field 1 will be displayed in the DVDs section on my page.

ConnectFollow ShopSite on FacebookFollow ShopSite on TwitterRead ShopSite's Ecommerce BlogWatch Ecommerce Videos on YouTube
Featured TutorialFacebook Connect for Customer Registration

Facebook Connect for Registration