Jump to content

$category = $category_parent


Recommended Posts

Hi guys
I just started to design a new webshop with PrestaShop. The CMS looks really nice!

Since I want to change the design quite a bit I need to modify category.tpl. Because we have four categories and sub categories:

Main A
 Sub A1
 Sub A2
 Sub A3
Main B
 Sub B1
 Sub B2



The problem is that if we open a Sub Category (A2 for example) it only shows the products from this sub category. So it should still show all products from Main A in my homepage. Do you have any idea how this could be done in category.tpl? I'd need a command to replace $category with $parent_category or something like that.

Does anyone has an idea? I only know that I can get the ID from the parent category with {$category->id_parent}. But that's only the ID. How do I get a whole $parent_category?

My idea is to use a code like this at the beginning of category.tpl:

If $category->id_parent NOT 1 (=is subcategory) then
   $category = $parent_category
End If



Thanks for your help!
Big_Berny

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...