我想使用商店名称作为搜索来获取Magento商店ID。
我尝试了以下代码,但失败了。
$vendortitle = $vendortitle . " Store";
$name = Mage::getModel('core/store')->load($vendortitle)->getStoreId();
echo "<br>Store Name> ". $name;
提前致谢。
答案 0 :(得分:1)
你的意思是商店代码?如果是这样,试试这个:
echo Mage::app()->getStore()->getCode(); // gives 'default'
// then use the following to get the store id
echo Mage::app()->getStore('default')->getId();