tareqhassan Posted March 30, 2014 Share Posted March 30, 2014 (edited) Hello experts, I'm a small developer with very few knowledge in prestashop CMS. I tried to put if conditions in the header.tpl section with specific ulrs but can't work it out. {if $page_name=='index'} <link rel="canonical" href="{$base_dir}" /> {elseif 'base_url' =>'http://example.com/product.html'} <link rel="canonical" href="http://example.com/product.html"/> {else} <link rel="canonical" href="http://{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}" /> {/if} 1st and last part of this code is working but middle one is not working. How can i define a specific condition for specific url with if condition? Please note that, i don't need solutions of canonical tags, just need to know how to declare the url with if conditions in prestashop? Thanks in advance Edited March 30, 2014 by tareqhassan (see edit history) Link to comment Share on other sites More sharing options...
inweb Posted March 30, 2014 Share Posted March 30, 2014 {if $page_name=='index'} <link rel="canonical" href="{$base_dir}" /> {elseif $smarty.server.REQUEST_URI == '/product.html'} <link rel="canonical" href="http://example.com/product.html"/> {else} <link rel="canonical" href="http://{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}" /> {/if} Link to comment Share on other sites More sharing options...
vekia Posted March 30, 2014 Share Posted March 30, 2014 base_url base url is an url to your shop homepage, something like http://example.com/ Link to comment Share on other sites More sharing options...
mdusamaansari Posted May 27, 2014 Share Posted May 27, 2014 Hi Techies, I need a condition in my order-opc.tpl file. if url is "http://example.com/index.php?controller=order-opc" { certain set of tpl files to be loaded } if url is "http://example.com/index.php?controller=order-opc&step=2" { another set of tpl files to be loaded } Please help me to this issue. Link to comment Share on other sites More sharing options...
inweb Posted May 27, 2014 Share Posted May 27, 2014 (edited) {if Tools::getValue('step') == 2} {* tpl files to be loaded *} {else} {* tpl files to be loaded *} {/if} Edited May 27, 2014 by inweb (see edit history) 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