Reputation: 252
I am using magento 1.7.0.2 and I need to display the title of CMS page in my store.
I have two stores, one is in English and the other is in French.
To get the title of the CMS page I am using below code
$page = Mage::getModel('cms/page')->load('legal');
Here 'legal' is my page identifier. I have created two pages in my admin panel having the same url key for english and french store having different page titles. But when I try to get the title using,
$pageTitle = $page->getTitle();
It always displays me the title of English CMS page. I have also tried to load the page using,
$page = Mage::getModel('cms/page')->setStore(Mage::app()->getStore()->getId())->load('legal');
without success. Any Idea??
Upvotes: 0
Views: 4887
Reputation: 2495
Have a look at Mage_Cms_Helper_Page
. It explains how pages are rendered.
Instead of using setStore()
, try setStoreId()
:
Mage::getModel('cms/page')->setStoreId(Mage::app()->getStore()->getId())->load('legal');
Upvotes: 4
Reputation: 11853
If you are creating two pages for both store then
you must have to careful when you assign page to particular store.
Please check for both pages it must be assign to only one store either a English OR French.
These could be main issue to get your pages every time english if you assign both pages in english store.
Please double check from admin.
Hope you can understand my thoughts.
Upvotes: 0