2012-02-21 34 views
12

如何確定我的商店視圖ID是什麼?如何找出我的商店ID是什麼?

修改數據庫中的表時這是必需的。

+0

爲什麼你需要這個商店ID?如果您確實需要它,請查看錶core_store中的數據庫。 – Alexandre 2012-02-21 08:41:16

+1

@Alexandre在通過API插入產品時,您需要它。 – feeela 2012-02-28 14:46:37

+0

相關問題:http://stackoverflow.com/questions/2713042/how-to-get-store-information-in-magento – 2013-08-29 10:37:00

回答

20

截圖來說明Jevgeni橫溢的回答是:

enter image description here

正如他所說的,你應該去系統 - >管理存儲並在右列單擊所需的商店名稱。

+0

這真的很有幫助的隊友。歡呼 – 2014-10-02 10:32:29

8

當您在URL欄中點擊Manage stores中的特定商店時,應該有一個像store_id之類的參數。這是您的商店ID。或者,如果您將鼠標懸停在商店上,並且鏈接可能顯示在瀏覽器的右側(左側),則在「管理商店」屏幕中。在url中有store_id參數。我猜這是最簡單的。

或者在數據庫中有表:core_store。

+0

正確的你,謝謝 – 2012-02-21 23:21:56

1

你應該去「系統 - >管理商店」,並在右欄中點擊需要的商店視圖名稱。點擊這個/懸停,並檢查你的網址下找到的網址店鋪ID後/ STORE_ID/

一樣----- system_store/editStore/STORE_ID//按鍵/

5

store_code獲得store_id用途:

echo Mage::app()->getStore('store_code')->getId(); 
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/>"; 
     } 
    } 
?> 
+0

第二個ftw! – ahnbizcad 2017-09-18 18:58:38

5

查找到數據庫中core_store表。