Jump to content

Blockcategories display Parentcategories


EmanuelHuber

Recommended Posts

Dear prestashop community,
 
I spent couple of hours to figure this out, but without success. So I contact you, maybe you have a solution for this.
 
We run Prestashop 1.6.0.14 and have about 1200 categories and subcategories in total. Those of you who spend some time with SEO know, that this leads to a horrible internal linking problem due to the blockcategories-module.
 
So here is some more information: we have ~12 top-level categories. At the moment the blockcategories-modules builds all 1200 links to all category-pages. 
What I need:
1.) When I navigate to "Home", blockcategories have 12 links - to the top level categories.

A
B
C
D
...

2.) When I click on the first top-level category, the child-categories of this specific top-level category are listed - but not the child-categories of the other top-level categories.

A
---a
---b
---c
---d
B
C
D

 
 
3.) when I click on "a", all Top-Level categories, the selected category, the siblings of the selected category and the children of the selected category are listed, but not the children of the siblings of the selected category

A
---a
------1
------2
------3
------4
---b
---c
---d
B
C
D

4.) and so on

A
---a
------1
---------%
---------$
---------&
------2
------3
------4
---b
---c
---d
B
C
D

 
So what I figured out so far: 
I changed the category-tree-branch.tpl to

{if $node.children|@count > 0 && $node.id == $currentCategoryId && isset($currentCategoryId)}
   <ul>
      {foreach from=$node.children item=child name=categoryTreeBranch}
           {if $smarty.foreach.categoryTreeBranch.last}
                {include file="$branche_tpl_path" node=$child last='true'}
           {else}
                {include file="$branche_tpl_path" node=$child last='false'}
           {/if}
      {/foreach}
   </ul>
{/if}

This works for the selection of a top-level  category

A
---a
---b
---c
---d
B
C
D
 

But as soon as I click  on "a", only

A
B
C
D

is shown.

 

Ok so I guess I somehow need the parent-category, but I have no clue how. In some prestashop.php files I found a var "id_parent_category", but I can't really use it, as far as i figured out.

 

Any ideas on that problem? I can't be the only one...

 

Regards,

Emanuel

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