We are doing custom Magento themes, Magento design, custom Magento extensions and creative services through Magento designers & developers for worldwide shop owners.

Last News
Magento How to get current store id  in admin

Magento How to get current store id in admin

this very useful snippet for find the current store id in admin in Magento :

1
2
3
4
5
6
7
8
9
10
11
12
13
if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) // store level
{
    $store_id = Mage::getModel('core/store')->load($code)->getId();
}
elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) // website level
{
    $website_id = Mage::getModel('core/website')->load($code)->getId();
    $store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
}
else // default level
{
    store_id = 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*