9

I’m completely stumped. I’m working on my first eCommerce website using the “Store Module”. The problem that I’m running into is in regards to Categories. I have setup a number or categories for the products. It happens to be a Vacuum store. Here’s my issue….

In the Central Vacuums category there are 7 sub categories that break this category down. (ie. canisters, powerheads, accessories, etc.). I am displaying the list of sub categories based on the URI segment (ie. if you are in the Central Vacuums category it displays the sub categories. I have gone one step further and am only displaying the sub categories that have been selected by at least 1 entry (ie. categories that have never been selected within an entry will not display in the sidebar).

The problem I’m having is that Once I choose a product and am moved to the “Single Entry” page for that specific product, the URI no longer displays the category information and my category and sub category information disappears.

Is there any way to show the category information on a “Single Entry” page?

Sorry this was so long winded. Very confused how to handle this.

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Title</title>
</head>
<!--BODY-->
<body>
       <h6>Products</h6>
        <ul>
            <li><a href="{path='products/index/c/central-vacuums'}">Central Vacuums</a></li>
            <li><a href="{path='products/index/c/portable-vacuums'}">Portable Vacuums</a></li>
            <li><a href="{path='products/index/c/carpet-steam-cleaners'}">Carpet/Steam Cleaners</a></li>
            <li><a href="{path='products/index/c/bare-floor-cleaners'}">Bare Floor Cleaners</a></li>
            <li><a href="{path='products/index/c/commercial-equipment'}">Commercial Equipment</a></li>
            <li><a href="{path='products/index/c/air-purification-equipment'}">Air Purification Systems</a></li>
            <li><a href="{path='products/index/c/parts-and-accessories'}">Parts &amp; Accessories</a></li>
        </ul>
        <h6>Categories for </h6>
        <!--start of categories-->
        {if segment_3 =='central-vacuums'}
            {exp:gwcode_categories show="90|91|92|93|94|95|96|97" last_only="yes" show_empty="no"}
                <a href="#">{cat_name}</a>
            {/exp:gwcode_categories}
        {/if}   
        {if segment_3 =='portable-vacuums'}
            {exp:gwcode_categories show="83|84|85|86|87|88|89" last_only="yes" show_empty="no"}
                <a href="#">{cat_name}</a>
            {/exp:gwcode_categories}
        {/if}
        {if segment_3 =='carpet-steam-cleaners'}
            {exp:gwcode_categories show="98" last_only="yes" show_empty="no"}
                <a href="#">{cat_name}</a>
            {/exp:gwcode_categories}
        {/if}   
        {if segment_3 =='bare-floor-cleaners'}
            {exp:gwcode_categories show="99" last_only="yes" show_empty="no"}
                <a href="#">{cat_name}</a>
            {/exp:gwcode_categories}
        {/if}   
        {if segment_3 =='commercial-equipment'}
            {exp:gwcode_categories show="100|101|102|103|104" last_only="yes" show_empty="no"}
                <a href="#">{cat_name}</a>
            {/exp:gwcode_categories}
        {/if}   
        {if segment_3 =='air-purification-equipment'}
            {exp:gwcode_categories show="105" last_only="yes" show_empty="no"}
                <a href="#">{cat_name}</a>
            {/exp:gwcode_categories}
        {/if}   
        {if segment_3 =='parts-and-accessories'}
            {exp:gwcode_categories show="106|107|108|109|110|111" last_only="yes" show_empty="no"}
                <a href="#">{cat_name}</a>
            {/exp:gwcode_categories}
        {/if}   
        <!--end of categories-->                        
        <h6>Brands for </h6>
        <!--start of brands-->
        {if segment_3 =='central-vacuums'}  
            {exp:channel:entries channel="products" category="90|91|92|93|94|95|96|97" status="featured|open"}
                {exp:playa:children field="brand"}
                    <li><a href="#">{title}</a></li>
                {/exp:playa:children}
            {/exp:channel:entries}
        {/if}
        {if segment_3 =='portable-vacuums'} 
            {exp:channel:entries channel="products" category="83|84|85|86|87|88|89"}
                {exp:playa:children field="brand"}
                    <li><a href="#">{title}</a></li>
                {/exp:playa:children}
            {/exp:channel:entries}
        {/if}
        {if segment_3 =='carpet-steam-cleaners'}    
            {exp:channel:entries channel="products" category="98"}
                {exp:playa:children field="brand"}
                    <li><a href="#">{title}</a></li>
                {/exp:playa:children}
            {/exp:channel:entries}
        {/if}
        {if segment_3 =='bare-floor-cleaners'}  
            {exp:channel:entries channel="products" category="99"}
                {exp:playa:children field="brand"}
                    <li><a href="#">{title}</a></li>
                {/exp:playa:children}
            {/exp:channel:entries}
        {/if}
        {if segment_3 =='commercial-equipment'} 
            {exp:channel:entries channel="products" category="100|101|102|103|104"}
                {exp:playa:children field="brand"}
                    <li><a href="#">{title}</a></li>
                {/exp:playa:children}
            {/exp:channel:entries}
        {/if}
        {if segment_3 =='air-purification-equipment'}   
            {exp:channel:entries channel="products" category="105"}
                {exp:playa:children field="brand"}
                    <li><a href="#">{title}</a></li>
                {/exp:playa:children}
            {/exp:channel:entries}
        {/if}
        {if segment_3 =='parts-and-accessories'}    
            {exp:channel:entries channel="products" category="106|107|108|109|110|111"}
                {exp:playa:children field="brand"}
                    <li><a href="#">{title}</a></li>
                {/exp:playa:children}
            {/exp:channel:entries}
        {/if}
        <!--end of brands-->
        <h6>Shop By Price for {last_segment_category_name}</h6>
        <hr>
            <ul>
                <li><a href="#">$0.00 - $99.99</a></li>
                <li><a href="#">$100.00 - $199.99</a></li>
                <li><a href="#">$200.00 - $399.99</a></li>
                <li><a href="#">$400.00 - $799.99</a></li>
                <li><a href="#">$800.00 and over</a></li>
            </ul>
        </li>
</body>
</html>
  • could you post some template code. – CreateSean Nov 22 '12 at 22:06
  • Hi Folks. Thank you all for responding. Here is the code I'm using on the Categories page. I need this side nav to work on a single entry page. Any suggestions? – Mark Dodgson Nov 23 '12 at 14:31
  • Mark, did any of the answers help you? If yes, please mark the answer correct by clicking on the checkmark to the left of the answer. – Anna_MediaGirl Dec 22 '12 at 6:20
7

Generally in ExpressionEngine you don't keep the category information in the URL for your single entry page. This is because an entry can belong to more than one category, so you will end up with more than one URL for the same product, which is bad for SEO.

If you really want to do this, you might find Low's Seg2Cat helpful.

  • Hi Adrian. thanks for the response. I apologize, I'm still quite new to all of this. I took a look at Low's seg2Cat, but I didn't see how I could get category information on the Single entry page. I feel like this has to be possible. Is there no way to get a list of categories related to the product on the single entry page? Again.... Thanks. – Mark Dodgson Nov 23 '12 at 14:58
6

Well, you could get the list and info of categories you have assigned the entry to by Categories tag inside the Channels entry tag. Is this something on the way to the final goal?

  • Hi Davor. Thanks for the response. I'm going to give your suggestion a try. Maybe I'm looking at the problem incorrectly. Thanks again... – Mark Dodgson Nov 23 '12 at 14:59
3

It's not in the plugin documentation, but have you tried adding dynamic="no" to the tag?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.