Given I have a Page Object (Mage_Cms_Model_Page), how do I get its associated store id's? As an array is preferable.

3 Answers 3


You can do $page->getStoreId() which will return an array (it can return null on new instances which are not yet saved to the DB).

In the page's resource model Mage_Cms_Model_Resource_Page there is an _afterLoad() method which will get the associated store ID's from the cms_page_store table and set them to the model as 'store_id' which you can get by calling getStoreId().

  • 1
    Thank you, that's correct. I happened to be getting my page object from the page collection which doesn't execute the _afterLoad method.
    – Raj
    Apr 7, 2015 at 13:46
  • I think I ran into something similar myself and posted it here: magento.stackexchange.com/questions/63581/…
    – 7ochem
    Apr 14, 2015 at 13:58

You can use the resource model for cms/page to lookup the storeIds

  • This method also works.
    – Raj
    Apr 7, 2015 at 13:49

Hi Please try with resource model which is give the store id basic of

   $Store_ids= $page->getResource()->lookupStoreIds($page->getId());

It give the array for store ids using fetchCol().

$select  = $adapter->select()
    ->from($this->getTable('cms/page_store'), 'store_id')
    ->where('page_id = ?',(int)$pageId);

return $adapter->fetchCol($select);

This every used full whenever you can get store id from collection of cms page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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