8

Given a store id, how do I get the website id that matches that store?

20

Like this:

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

Or do a direct database lookup on the core_store table.

10

Just for completeness: From the current store you're in, you could retrieve the websiteId as follows:

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

In Magento 2 to you can find the Website Id using store id like this:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.