Jump to content

Sub categories


Recommended Posts

hello, 

 

can anyone help me with a small issue i have, 

 

i created a multistore with prestashop1.6, using lab arion3 theme, 

 

the issue is that when i click a category, it is showing the products assigned to all the sub-categories in that category

i need that when someone is clicking a main category, it returns the sub categories then clicking a subcategory it returns the products within.

 

Thanks in advance for any idea!

Link to comment
Share on other sites

Check the product of a category and go to the association tab and see if you have both the root and sub categories selected for the product if so remove the selection for the root category and the product should now only show in the sub.

Thanks mate, I tried, it doesn't work.

 

For instance, for one parent category with 4 sub categories and no products in any of them, clicking the parent category, instead of showing the sub categories, it says that "there are no products in this category".

Please help!

Link to comment
Share on other sites

Are you using the default theme or a custom one, look at the category.tpl file in the themes root folder.

Check to see if the subcategories section is commented out or missing.

What Ver, of presta are you using

 

This is the complete subcategory section from the tpl file in 1.6.1.4 it's at line 72-99. if it is not there copy and paste this code and see if it works.

 

 

 

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1>
{if isset($subcategories)}
        {if (isset($display_subcategories) && $display_subcategories eq 1) || !isset($display_subcategories) }
<!-- Subcategories -->
<div id="subcategories">
<p class="subcategory-heading">{l s='Subcategories'}</p>
<ul class="clearfix">
{foreach from=$subcategories item=subcategory}
<li>
                <div class="subcategory-image">
<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}" title="{$subcategory.name|escape:'html':'UTF-8'}" class="img">
{if $subcategory.id_image}
<img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html':'UTF-8'}" alt="{$subcategory.name|escape:'html':'UTF-8'}" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{else}
<img class="replace-2x" src="{$img_cat_dir}{$lang_iso}-default-medium_default.jpg" alt="{$subcategory.name|escape:'html':'UTF-8'}" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{/if}
</a>
                    </div>
<h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:25:'...'|escape:'html':'UTF-8'}</a></h5>
{if $subcategory.description}
<div class="cat_desc">{$subcategory.description}</div>
{/if}
</li>
{/foreach}
</ul>
</div>
        {/if}
{/if}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...