mardon Posted May 17, 2012 Share Posted May 17, 2012 Hi all, i want show some block only in specific pages - in some category or some cms page. It is possible or may i use some module? Link to comment Share on other sites More sharing options...
MEG Venture Posted May 17, 2012 Share Posted May 17, 2012 (edited) Hi mardon It is possible. What you should do is go to your Back Office, Under Modules>Positions>select your module from the combo box then you will see the hooks that your module is displayed. Let's assume that you will edit CMS block and that it is hooked on left column. Select Left Column Blocks and click the edit icon next to your module name. Now to the exception field write the pages that you don't want the module to be displayed. Here the trick is that you have to write all other pages like index.php, order.php, product.php, etc. Alternatively, you can use Smarty to hide the module code on every page but the one you want. For example, to show a module only on the homepage, add the following to the top of the module's TPL file: {if $page_name == 'index'} For a CMS page like cms.php?id_cms=4 you should write to the top {if $smarty.get.id_cms == 4} Hope this helps. Cheers Edited May 17, 2012 by Caglar (see edit history) Link to comment Share on other sites More sharing options...
bretweb Posted November 10, 2015 Share Posted November 10, 2015 Hello I saw your post ... perhaps you can help me I would like to manage displaying for 3 htmlmodule under their own category module_name=htmlanimaux be only displayed under category 3 module_name=htmlbienetre be only displayed under category 4module_name=htmlmaisonjardin be only displayed under category 13 Or hide 2 of them when we are on the third categoryI saw somewhere that we need to add smarty code into header How I can do that ? thanks for your help Link to comment Share on other sites More sharing options...
matejmili Posted November 10, 2015 Share Posted November 10, 2015 Hi ! how can hide catergory in checkout ? I have buy module bankwirepro from myprest.eu and now is show category in checkout ? Link to comment Share on other sites More sharing options...
MEG Venture Posted November 10, 2015 Share Posted November 10, 2015 Hello I saw your post ... perhaps you can help me I would like to manage displaying for 3 htmlmodule under their own category module_name=htmlanimaux be only displayed under category 3 module_name=htmlbienetre be only displayed under category 4 module_name=htmlmaisonjardin be only displayed under category 13 Or hide 2 of them when we are on the third category I saw somewhere that we need to add smarty code into header How I can do that ? thanks for your help Hi You can do this following the below instructions: 1. Open each module's php file: htmlanimaux.php, htmlbienetre.php and htmlmaisonjardin.php 2. Find the regarding hook function (if the module is positioned at columns, hookRightColumn or hookLeftColumn, etc. ) 3. There you'll see the smarty variable settings (something like $this->smarty->assign(array(....) 4. Add the below smarty variable in this array: 'categoryid' =>Tools::getValue( 'id_category' ), 5. Open the smarty template files of each module and add the below lines to the top: For the htmlanimaux: {if $page_name = category} {if $categoryid == 3} For the htmlbienetre: {if $page_name = category} {if $categoryid == 4} For the htmlmaisonjardin: {if $page_name = category} {if $categoryid == 13} 6. Then add the below line to the bottom of each template: {/if}{/if} There you go! Hi ! how can hide catergory in checkout ? I have buy module bankwirepro from myprest.eu and now is show category in checkout ? Picture is not displayed. Link to comment Share on other sites More sharing options...
8ternity Posted January 27, 2020 Share Posted January 27, 2020 On 5/17/2012 at 8:05 AM, MEG Venture said: Hi mardon It is possible. What you should do is go to your Back Office, Under Modules>Positions>select your module from the combo box then you will see the hooks that your module is displayed. Let's assume that you will edit CMS block and that it is hooked on left column. Select Left Column Blocks and click the edit icon next to your module name. Now to the exception field write the pages that you don't want the module to be displayed. Here the trick is that you have to write all other pages like index.php, order.php, product.php, etc. Alternatively, you can use Smarty to hide the module code on every page but the one you want. For example, to show a module only on the homepage, add the following to the top of the module's TPL file: {if $page_name == 'index'} For a CMS page like cms.php?id_cms=4 you should write to the top {if $smarty.get.id_cms == 4} Hope this helps. Cheers If i want to include all CMS pages? not just one page ID's? How we can do it. Thanks. Link to comment Share on other sites More sharing options...
MEG Venture Posted January 27, 2020 Share Posted January 27, 2020 I would try the below code to show on all cms pages {if $smarty.get.id_cms > 0} your script {/if} Link to comment Share on other sites More sharing options...
8ternity Posted January 27, 2020 Share Posted January 27, 2020 (edited) Its a part of code on page.tpl into template folder. Original code <section id="main"> {block name='page_header_container'} {block name='page_title' hide} <h1 class="page-heading">{$smarty.block.child}</h1> {/block} {/block} I want to do : <section id="main"> {block name='page_header_container'} {if $smarty.get.id_cms > 0} {else} {block name='page_title' hide} <h1 class="page-heading">{$smarty.block.child}</h1> {/if} {/block} {/block} Is gonna work that way? EDIT: No, it's breaking the page to load. I just to to hide the <h1> object if smarty get id from CMS. Edited January 27, 2020 by 8ternity (see edit history) Link to comment Share on other sites More sharing options...
MEG Venture Posted January 27, 2020 Share Posted January 27, 2020 I would rather try the below one to hide the block on all CMS pages. <section id="main"> {block name='page_header_container'} {if $smarty.get.id_cms > 0} {else} {block name='page_title' hide} <h1 class="page-heading">{$smarty.block.child}</h1> {/block} {/if} {/block} 1 Link to comment Share on other sites More sharing options...
8ternity Posted January 27, 2020 Share Posted January 27, 2020 It's worked. My god, thank you ! You helped me a lot. Im not a programmer but i can learn some things and i was close. Thanks a lot 1 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