Jump to content

Hide category in blockcategories?


Recommended Posts

Could someone please explain to me how to hide specific categories from the blockcategories module while having them still accessible by URL?

 

I have tried the following which I found on this forum, but it didn't work out for me.

 

Modify modules/blockcategories/category-tree-branch.tpl and add {if $node.id != 1} to the start of the file and {/if} to the end of the file, where 1 is the id of the category you want this hide. This will hide that category and its subcategories, while making them still accessible by URL.

 

You'll need to modify category-tree-branch.tpl in your theme's directory too so that the categories are hidden from the sitemap.

 

Your help is much appreciated!

  • Like 2
Link to comment
Share on other sites

Thank you for your time Prescol.

Unfortunately I was not able to find the option Show products = no. Also, I think that this option is not what I'm looking for, because I would like to be able to link to the (hidden) category including all of its products instead of a single product.

So, I want to have a working link to a category that does not show up in the blockcategories.

 

Do you perhaps have any other ideas?

Link to comment
Share on other sites

Hii Rolf, i have tested the code from the first post and it works perfect

 

This is the result code

{if $node.id!=3}
<li {if isset($last) && $last == 'true'}class="last"{/if}>
<a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a>
{if $node.children|@count > 0}
 <ul>
 {foreach from=$node.children item=child name=categoryTreeBranch}
  {if isset($smarty.foreach.categoryTreeBranch) && $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}
</li>
{/if}

  • Like 2
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

I have the same issue as Rolf1, as this:

 

Modify modules/blockcategories/category-tree-branch.tpl and add {if $node.id != 1} to the start of the file and {/if} to the end of the file, where 1 is the id of the category you want this hide. This will hide that category and its subcategories, while making them still accessible by URL.

 

You'll need to modify category-tree-branch.tpl in your theme's directory too so that the categories are hidden from the sitemap.

doesn't work for me. I have tried the above, even going so far as to cutting and pasting the code provided by Prescol, and it makes no difference whatsoever - all of my categories are still appearing in the category block. I am running Prestashop 1.4.8.2, I've cleared my cookies and my cache and have force compiled. I have made the change to both the core file and to category-tree-branch.tpl in themes/mytheme/modules/blockcategories.

 

Does anyone have any idea of what else I could try? I have tried searching the forum, and everything seems to point back to {if $node.id != 1}

 

Thanks in advance for any help or suggestions you can provide.

Link to comment
Share on other sites

  • 3 weeks later...

Brilliant..... work perfectly :D (make sure you force compile, clean cache, etc) :) many thanks! Also make sure you have the correct id.... dont use 2 because the category is second on your menu... make sure u use the ID from the back Office.....

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...

AND for those, who want to remove subcategories pictures in the product list page -

 

 

1. go to themes/your_theme/category.tpl

 

2. use this code:

 {if isset($subcategories) && $id_category!=5 && $id_category!=6 && $id_category!=7 && $id_category!=8}

the style and the description of Your subcategories picture

{/if}

 

Just change the numbers in the "&& $id_category!=[category number you want to hide]" to the ID number of your category in the catalogue at backoffice - the result: when You open the category with included number in the conditions above, You will not see the subcategories menu. I hope this will help someone!

Edited by sting5 (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...

If you want to hide multiple categories, what would that snippet of code look like?

 

EDIT: Strike that, I found the answer on another thread:

{if $node.id != 1 AND $node.id != 2}

 

However, I'm seeing that the categories only remain hidden so long as I have caching turned off. Once I turn it back on, the categories I wanted to hide are showing again. Tried clearing cache and cookies too. Has anyone seen this?

Edited by jmthd (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 7 months later...
  • 1 year later...
×
×
  • Create New...