Sean Raviolli Posted April 28, 2013 Share Posted April 28, 2013 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 More sharing options...
Joel Bardsley Posted April 29, 2013 Share Posted April 29, 2013 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 More sharing options...
Sean Raviolli Posted May 5, 2013 Author Share Posted May 5, 2013 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 More sharing options...
Alejandro Fernandez Posted May 9, 2013 Share Posted May 9, 2013 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 More sharing options...
Sean Raviolli Posted May 9, 2013 Author Share Posted May 9, 2013 Hey Maria, Can you post a link to your website? I actually did nothing with blockcategories.tpl -- I changed the code in header.tpl of my theme. Link to comment Share on other sites More sharing options...
silentRun Posted June 20, 2013 Share Posted June 20, 2013 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 More sharing options...
silentRun Posted June 20, 2013 Share Posted June 20, 2013 <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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now