I want to get the default store ID of currently active website. I tried Mage::app()->getStoreId()
, but that gets the current store, not the default store ID of the current website.
How can I get it?
You can get store ID by calling the block function in your phtml file. echo $block->getStoreId(); Using Object Manager.
You need to go to System > Manage Stores and click on the store name in the right-hand column. Then check the URL for the store_id element - this is your store ID on Magento.
Go to Administration (click on the gear icon in the top right of the screen). Click on the Measurables(or Websites) > Manage page. You will find a list of all websites on this page. The website ID is on the left of the table listing all websites directly below the website name.
Assuming you're talking about the default store id defined per store group, then e.g. like this:
$iDefaultStoreId = Mage::app()
->getWebsite()
->getDefaultGroup()
->getDefaultStoreId();
The original question was on how to retrieve the default store ID of currently active website, so the answer is correct. However in order to get the default frontend store ID from within the admin panel you need to pass the parameter true
to the method getWebsite()
:
$iDefaultStoreId = Mage::app()
->getWebsite(true)
->getDefaultGroup()
->getDefaultStoreId();
you can get default store id like following:
Mage_Core_Model_App::ADMIN_STORE_ID
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With