检查store_id Magento

时间:2012-11-21 12:52:54

标签: php magento

我想检查哪个商店ID当前处于活动状态,并显示商店ID是例如1

我现在的代码是:

<?php if (Mage::getModel('core/store')->load($storeId) == 9): ?>
//code here
<?php endif; ?>

但无论商店ID是什么,它总是返回if代码。我认为问题出在“==”检查中。有人能告诉我正确的语法是什么吗?

2 个答案:

答案 0 :(得分:1)

获取当前商店信息

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

这将解释更多

how to get store information in Magento?

答案 1 :(得分:1)

<?php if (Mage::app()->getStore()->getStoreId() == 9): ?>

在你的情况下