Magento is one of the most powerful e-commerce platform to manage your multiple website or multiple store, yet it has a very complex programming structure. I believe you have successfully setup your multi-store in an only one Magento folder. Sometime it isn’t necessary to create a child theme for your theme. You may prefer to do little programming like conditional statement. So let’s get started.
If you are planning to do a tweak in your .phtml theme file e.g. file path ~/yourtheme/default/template/page/html/head.phtml
..and do a conditional statement to display something according to either Store view or website view.
Store View
Get Store ID
<?php if (Mage::app()->getStore()->getId() == 'yourStoreID'){ ?> //Insert your HTML or JS Code Here <?php } else { ?> //insert your HTML or JS Code Here <?php } ?>
Or Get Store Code
<?php if (Mage::app()->getStore()->getCode() == 'yourStoreCode'){ ?> //HTML or JS Code Here <?php } else { ?> //HTML or JS Code Here <?php } ?>
Website View
Get Website ID
<?php if (Mage::app()->getWebsite()->getId() == 'yourWebsiteID'){ ?> //HTML or JS Code Here <?php } else { ?> //HTML or JS Code Here <?php } ?>
Or Get Website Code
<?php if (Mage::app()->getWebsite()->getCode() == 'yourWebsiteCode){ ?> //HTML or JS Code Here <?php } else { ?> //HTML or JS Code Here <?php } ?>
To get your Store Code
From Dashboard, go to System > Manage Stores
Under ‘Store View Name’ column, click your store name e.g. ‘Store1Name’
Get the store value in ‘Code*’ field
To get your Store Code
From Dashboard, go to System > Manage Stores
Under ‘Website Name’ column, click your website name e.g. Store1Website
Get the website value in ‘Code*’ field
Enjoy coding!
Hi, what should i do if i want to write a code for homepage statement.