To get the current running website id. All the Magento web developers may need to write this code while developing a Magento website in one way or another.
//Will return as integer
$website_id = Mage::app()->getWebsite()->getId();
//Will return as us,en,ae
$websitecode = Mage::app()->getWebsite()->getCode();
Find instructions here to download Magento 2 and install.
Did this post help you?
Tutsplanet brings in-depth and easy tutorials to understand even for beginners. This takes a considerable amount of work. If this post helps you, please consider supporting us as a token of appreciation:
- Just want to thank us? Buy us a Coffee
- May be another day? Shop on Amazon using our links.
Your prices won't change but we get a small commission.
Masoud says
Perfect. Thanks