给定一个商店 ID,如何获取与该商店匹配的网站 ID?

有帮助吗?

解决方案

像这样:

Mage::getModel('core/store')->load($storeId)->getWebsiteId()

或在core_store表上进行直接数据库查找。

其他提示

仅出于完整性:从您所在的当前商店中,您可以检索网站ID如下:

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

在 Magento 2 中,您可以使用商店 ID 找到网站 ID,如下所示:

$this->_storeManager->getStore($storeID)->getWebsiteId();

许可以下: CC-BY-SA归因
scroll top