如何确定是否从默认,网站或店面视图中获取Magento配置

时间:2012-11-30 08:41:28

标签: magento

E.g。配置:

default:      some/xml/path: value_1
storeview_5:  some/xml/path: other_value

现在提取:

// store 5
Mage::getStoreConfig('some/xml/path'); // >> other_value
// store 1
Mage::getStoreConfig('some/xml/path'); // >> value 1 (inherited from default)

我想知道storeview_1没有自己的配置。

最好的方法是获取配置树,如:

default     => value_1
website_1   => website_value
storeview_1 => storeview_1_value
storeview_5 => other_value 
// omits empty configs for others or null them, etc.

1 个答案:

答案 0 :(得分:1)

方法getStoreConfig也接受可选的商店ID,因此只需将商店ID作为第二个参数传递  Mage::getStoreConfig('some/xml/path', $store_id);