Jump to content

Prevent categorize menu from showing up in special category.


Recommended Posts

Hi Everyone,

 

My e-shop is located at: http://autopartsaftermarket.us

 

I want the categories menu to "go away" (not displayed) when I click on specific category , let's say the first one. Any insights for this?

 

I need some kind of "exception" rule. I have a hand on coding so if someone can point me out to the correct direction i can fix this probably by adding an IF ELSE statement.

 

There reason for this is, i want all the products to be under one special category (called ALL) and enable layered navigation only there. This is the nature of our business.

 

 

Thanks!

 

 

PS: please let me know if this is the incorrect section to do this.

Link to comment
Share on other sites

Hi Anoush,

 

If you wanted to hide the block on all category pages, the easiest is to add an exception to the blockcategories module in Modules > Positions in the admin section.

 

For a specific category, you could add an if statement to header.tpl that adds a class to the body tag (ie .hideCategories) if the $currentCategoryID equals the ones you wanted. Then in global.css add something like:

 

.hideCategories #categories_block_left { display: none; }

 

Hope that helps!

Joel

Link to comment
Share on other sites

Thanks for the reply. Actually the code I used was this (as of prestashop 1.5.4)

 

{if isset($category->id) && $category->id == 22}
  $(document).ready(function(){
  //$('#categories_block_left').hide();
  $('#top-categ').find('span').text('Make, Model, Year Search');
  });
  {/if}

Link to comment
Share on other sites

Hello Joel and Anoush, or anybody who can give me a hand here, hopefully.

 

I have been searching everywhere how to hide a blockcategory for an specific category, and tried all codes I found, but none of them worked as I wanted.

 

I have 8 category blocks in the left column, I have duplicated one by one to have 8 diferent category menus on the left and each one with its own subcategories.

 

I want to keep all this category blocks in the homepage, but I want all of them to disappear when in a category page, except the module of category I am.

 

This is what I have tried:

 

in modules/blockcategories3/blockcategories3.tpl

 

I added this code at the begining:

 

{if $page_name != 'category' && $id_category == 7}

 

and at the end:

 

{/if}

 

The problem here is that the module blockcategory3 will desapear in every single page.

 

What code I have to add so the module will stay but just for that category page?

 

I have also tried the code on the previous post, in my blockcategories8.tpl:

 

 

{if isset($category->id) && $category->id == 12}

 

{/if}

 

but the module just disappears everywhere?

 

Any help here please? It would be much apreciated. Thanx!!!

Link to comment
Share on other sites

  • 1 month later...
Thanks for the reply. Actually the code I used was this (as of prestashop 1.5.4)
 {if isset($category->id) && $category->id == 22} $(document).ready(function(){ //$('#categories_block_left').hide(); $('#top-categ').find('span').text('Make, Model, Year Search'); }); {/if} 

 

 

Really nice solution ;)

 

You only forgot to add the <script> tags, so at the end the code will look like this :

 

{if isset($category->id) && $category->id == 22}
  $(document).ready(function(){
  //$('#categories_block_left').hide();
  $('#top-categ').find('span').text('Make, Model, Year Search');
  });
  {/if}

 

 

Add to the header.tpl and it will work

Link to comment
Share on other sites

<p>Sorry, I dont know how to remove the previous post.</p>

<p> </p>

<p>The code will be like this:</p>

<p> </p>

<div><span>

</span>
<div><span>{if isset($category->id) && $category->id == 22}</span></div>
<div><span>  <script></span></div>
<div><span>   $(document).ready(function(){</span></div>
<div><span>   //$('#categories_block_left').hide();</span></div>
<div><span>   $('#top-categ').find('span').text('Make, Model, Year Search');</span></div>
<div><span>   });</span></div>
<div><span></script></span></div>
<div><span>   {/if}</span></div>
<span>

</span></div>

 

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