ariom Posted June 17, 2015 Share Posted June 17, 2015 (edited) In the old 1.4.7.3 PS version to show a specific block in the left column depending on the page i am, i used to insert in the .tpl of the block the following javascript array (for cms pages) if $page_name == 'cms' AND $smarty.get.id_cms} {if in_array($cms_class, array(154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183))} {$content} {/if} {/if} now i'm trying to do the same on the new PS 1.6.0.14, but unfortunatly it doesn't work, i search the forum for a solution or a suggestion to come to the point without results. Anyone can help me suggesting what i have to change in that code to make it work? Any help is welcome! Edited January 11, 2016 by ariom (see edit history) Link to comment Share on other sites More sharing options...
selectshop.at Posted June 17, 2015 Share Posted June 17, 2015 (edited) You know the hook function in Prestasop 1.6. ? Go to modules > positions > on top green nav bar > move a module and you can on the next page set the behaviour of your modules (blocks) on the specific pages by using restrictions on the pages selected on bigger block there. Edited June 17, 2015 by selectshop.at (see edit history) Link to comment Share on other sites More sharing options...
ariom Posted June 18, 2015 Author Share Posted June 18, 2015 thanks for your suggestion... i know what you are talking about, but i'm looking for a different thing, i Have 200 cms pages in 6 categories, for ten of them i want a specific module on the left column, for other 25 cms page i want a totally different module and not the first one, and so on.... with hook function i can only view all this modules in all cms pages, i'm looking for the right js code to conditionally select an array of specific cms pages by their id to show one module, another array of cms pages by their id for another module and so on ... before i used that js code in my first post, but with 1.6 it's not working. Thanks for helping and sorry for my english... Link to comment Share on other sites More sharing options...
ariom Posted June 21, 2015 Author Share Posted June 21, 2015 (edited) Ok, i solved myself, here how i did: 1) Create a file named FrontController.php in override/classes/controllers (if you already have it, you need to merge with your) and copy inside the following code (to get in the context the variable id_cms from the db) public function init() { $id_cms = array(); parent::init(); $id_cms = (int)Tools::getValue('id_cms'); $this->context->smarty->assign(array('id_cms' => $id_cms)); } 2) insert (in the module template file) an array of all the id for the cms pages in wich i want my modules to be shown in the left column (or any other hook i want, the variable it is now accessible from any cms page defined in the array): {if $page_name == 'cms' && $smarty.get.id_cms} {if in_array($id_cms, array(154,155,156,157,158))} <!-- Here is your module content --> {/if} {/if} That's all, hope someone else who need will enjoy it Edited June 21, 2015 by ariom (see edit history) 2 Link to comment Share on other sites More sharing options...
Steppo Posted July 20, 2015 Share Posted July 20, 2015 (edited) Beautiful solution! In my case i have 6 left blocks in the CMS module - and i would like only to show/ hide depending on cms page. Trying to figure out how this can be made in a solid way - but it is tricky indeed:) Made a post about this here... Edited July 20, 2015 by Steppo (see edit history) Link to comment Share on other sites More sharing options...
Guest locen Posted December 13, 2015 Share Posted December 13, 2015 Anyone know how i can modify blocks' module for different cms pages? For blogs' module I say "categories", "products viewed", " events ecc..anyone can help me? 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