Magento : Get Store Id, website Id, website info

After hours of searching on Google, i find out some ways to get Store and Website info 🙂

Get current store:

      Mage::app()->getStore();

Get current store Id:

Mage::app()->getStore()->getId();

Get current website Id:

$storeId = Mage::app()->getStore()->getId();

Mage::getModel(‘core/store’)->load( $storeId )->getWebsiteId();

Get store info by store code:

$storeCode = “your_store_code”;

 

Mage::getModel( “core/store” )->load( $storeCode );

Get website info by website code:

$websiteCode = “your_website_code”;

 

Mage::getModel( “core/website” )->load( $websiteCode );

Get all stores:

Mage::app()->getStores();

Happy coding :)….

Revisions

No comments yet.

Leave a Reply