aaronjpitts Posted July 15, 2013 Share Posted July 15, 2013 Hi guys, I have set up multistore with two shops (a .com and .ch domain). Is there a conditional if else statement I can use to output a different piece of code depending on which multistore is being used? Thanks Link to comment Share on other sites More sharing options...
Martin Uker K Posted July 15, 2013 Share Posted July 15, 2013 (edited) Yes you ca, But before that I need to know where (PHP version or tpl one). You'll have to test the actal shop_id in the context (PHP case). For the TPL one, read this really useful post (Pretty useful in Multi-shop) : http://www.prestasho...arty-variables/ It let you test the ms_id in tpls (multishop ID) Martin Edited July 15, 2013 by Martin Uker K (see edit history) Link to comment Share on other sites More sharing options...
aaronjpitts Posted July 15, 2013 Author Share Posted July 15, 2013 I'm using it the the .tpl, I've added the controller override with the code on that page. How do I target the $ms_id variable in smarty? Thanks Link to comment Share on other sites More sharing options...
Martin Uker K Posted July 15, 2013 Share Posted July 15, 2013 {if $ms_id == 4} Your code {else} Other else {/if} This would be the way, As simple as that. If you can't access ms_id, make sure your override is known by your prestasho: cache/class_index.php is up to date. If this file isn't just delete it and display one of your page (just rrefresh the home page) prestashop will re-scan an regenerate the file. To make sure you can access this variable try {$ms_id} this should display a number ( Your shop id). Good luck Martin Link to comment Share on other sites More sharing options...
aaronjpitts Posted July 15, 2013 Author Share Posted July 15, 2013 Ah ok, I just needed to update the class_index.php file, all works great. Thanks for your help. Link to comment Share on other sites More sharing options...
Martin Uker K Posted July 15, 2013 Share Posted July 15, 2013 Yeah I run in that problem a lot lately, that's why I mentionned it. Please mark this as Solved for further reference. Been a pleasure helping you, good luck with the rest of your website! Martin Link to comment Share on other sites More sharing options...
oscarhh Posted April 9, 2015 Share Posted April 9, 2015 Hi, is there a way to add a conditional if else statement in indexcontroller.php? I want my homepage to be a category page depending on the store 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