如何找出我的商店ID是什么?

时间:2012-02-21 06:05:47

标签: magento

如何弄清楚我的商店视图ID是什么?

修改数据库中的表时需要这样做。

6 个答案:

答案 0 :(得分:20)

屏幕截图来说明Jevgeni Smirnov的回答:

enter image description here

正如他所说,你应该去系统 - >管理商店并在右栏中点击所需的商店名称。

答案 1 :(得分:8)

当你点击URL栏中管理商店中的特定商店时,应该有一个像store_id之类的参数。这是您的商店ID。或者,如果将鼠标悬停在商店上,则在“管理商店”屏幕中,链接可能会显示在浏览器的右侧(左侧)。在url中有store_id param。这是我最容易猜到的。

或者在数据库中有table:core_store。

答案 2 :(得分:6)

务实地,您可以获得网站ID,网站名称,商店ID,商店名称和商店代码,如下所示:

<?php
echo "Website ID: " . Mage::app()->getWebsite()->getId() . "<br/>"; 
echo "Website Name: " . Mage::app()->getWebsite()->getName() . "<br/>"; 
echo "Store ID: " . Mage::app()->getStore()->getId() . "<br/>"; 
echo "Store Name: ".Mage::app()->getStore()->getName(). "<br/>";
echo "Store code: ". Mage::app()->getStore()->getCode()."<br/>";
?> 

以下是循环浏览所有网站并打印您在Magento中设置的所有商店ID和商店名称的示例:

<?php
foreach (Mage::app()->getWebsites() as $website) {
    foreach ($website->getGroups() as $group) {
        $stores = $group->getStores();
        foreach ($stores as $store) {
            echo $store->getId() ." ".$store->getName()."<br/>";
        }
    }
?> 

答案 3 :(得分:5)

要从store_id使用store_code使用

echo Mage::app()->getStore('store_code')->getId();

答案 4 :(得分:5)

查看数据库中的 core_store 表。

答案 5 :(得分:1)

您应该转到“系统 - &gt;管理商店”,然后在右栏中点击所需的商店视图名称。点击/悬停在此处并检查网址,您在/ store_id /

之后在网址下找到商店ID

与----- system_store / editStore / store_id / 1 / key /

相同