I have two store views, for 2 languages. I have a page 'foo' defined in both languages (i.e. store views). I'm using

$aCmsPage = Mage::getModel('cms/page')->load('foo', 'identifier');

However, I always get the page in the same language.

Shouldn't I get the page for the current store view?

What am I doing wrong?


You can use below code:

    $page   = Mage::getModel('cms/page');
            $pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId());
            if ($pageId) {
               aCmsPage = Mage::getModel('cms/page')->load($pageId);
| improve this answer | |

you have to set store id in call like

$cmsPage = Mage::getModel('cms/page')->setStore(Mage::app()->getStore()->getId())->load('foo', 'identifier');

so it will load cms page per current store.

hope this will sure work for you.

| improve this answer | |
  • Did not work ;( Any other ideas? – Tero Lahtinen Jun 13 '15 at 8:12
  • Second that - using setStore does not work – Alan A Jan 24 '19 at 15:39

You can use helper class Mage_Cms_Helper_Page's method getPageUrl, it gives the result of cms page URL with the correct store view

| improve this answer | |

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.