How do I get a website id from a store id?
-
16-10-2019 - |
문제
Given a store id, how do I get the website id that matches that store?
해결책
Like this:
Mage::getModel('core/store')->load($storeId)->getWebsiteId()
Or do a direct database lookup on the core_store table.
다른 팁
Just for completeness: From the current store you're in, you could retrieve the websiteId as follows:
Mage::app()->getStore()->getWebsiteId();
In Magento 2 to you can find the Website Id using store id like this:
$this->_storeManager->getStore($storeID)->getWebsiteId();
제휴하지 않습니다 magento.stackexchange