How i can get the scope_id value from core_config_data table of the current store-view?. I've tried using:
Mage::app()->getStore()->getStoreId();
But this doesn't return the scope_id value.
Thanks!
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communitycore_config_data
table contain two important fields scope
and scope_id
.
There are three scope types
If scope is set to default
then scope_id
is always 0.
If scope is set to websites
then scope_id
is website_id
.
If scope is set to stores
then scope_id
is store_id
(store view).
Imagine that we need to get some config value. How Magento will get the it for current store view?
Search value by priority:
scope == stores
and scope_id
== store_id(store view)
scope == websites
and scope_id
== website_id (to which belongs current store view)
scope == default
default section of config.xml
You can get current scope_id value after Save Config with this:
$code = Mage::getSingleton('adminhtml/config_data')->getStore();
$store_id = Mage::getModel('core/store')->load($code)->getId();
Mage::app()->getStore()->getStoreId();
will always be the admin store id which is 0