Jump to content

[Solved] Expanding & Collapsing Tree in Categories Block


Recommended Posts

Right now, you have to click the "+" next to the main category in the categories block to expand the tree and display the sub-categories.

I would like to remove the "+" box and edit the script to expand and display the sub-categories when I click on one of the main categories in the categories block.

Can someone tell me how to do this, or at least give em some direction? I was looking through the theme > current theme > js > tools > treeManagement.js file but I wasn't completely sure what I was looking for.

Thanks!

****EDIT****
Thread has been solved. If you are attempting to do the same thing, follow this thread.

Link to comment
Share on other sites

Ok so I am starting to get somewhere... I stumbled upon this thread where someone asked a very similar question and got this response from badjoker:

Hello,

Solution:

1st step - edit file 'category-tree-branch.tpl', located in yourshop/modules/blockcategories/

replace
{$node.name|escape:htmlall:'UTF-8'}


with

{$node.name|escape:htmlall:'UTF-8'}



2rd step - edit file'global.css', located in yourshop/themes/prestashop/css/

remove or comment classes

div#categories_block_left span.OPEN { 
       background: no-repeat left top url('../img/icon/less.gif'); 
}

div#categories_block_left span.CLOSE{ 
       background: no-repeat left top url('../img/icon/more.gif'); 
}

div#categories_block_left span.grower{
   display:block;
   float:left;
   background-position: 0px 3px;
   background-repeat: no-repeat;
   width:9px;
   height:15px;
   margin: 0 0 0 -10px!important;
   margin: 0 0 0 -6px;
   padding: 0;
}



This is exactly what I am looking for the tree to do, yet I still want the links of the subcategories to work. Does anyone know what to edit in the code posted above in the quote to achieve this? I'm still fiddling around with that code and the "a href" tags, but so far I haven't found what I'm looking for.

If possible, I would like the parent categories to simply expand to show the subcategories when clicked, and I would like the subcategories to be links and take you to the product list page when clicked.

With some fiddling around with the code from above, I've got
{$node.name|escape:html:'UTF-8'} 



The only problem is that when you click the parent category, it acts as a link and takes you to a product page that lists the subcategories. I only want the subcategories to act as links in the expanded tree, not the parent categories. I only want the parent categories to expand the tree.

So with that said, can this link code be edited to only apply to subcategories?

{$node.name|escape:html:'UTF-8'}

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