Silahkan Melihat Tutorial di website kami dengan nyaman ENJOY YOUR LIFE ☕

Get All Cms Page in magento

Hello,

Some Time You need to add Cms page in your site map. you need your page page link and name.
I have same issue. I getting for query and use it's working. you can try it.

Get all Cms Page in Magento

$storeId = $this->helper('core')->getStoreId(); // thanks to drawandcode for this
$cms = Mage::getModel('cms/page')->getCollection()
->addFieldToFilter('is_active',1)
->addFieldToFilter('identifier',array(array('nin' => array('no-route','enable-cookies'))))
->addStoreFilter($storeId);
$url = Mage::getBaseUrl();
$html = "";
foreach($cms as $cmspage):
$page = $cmspage->getData();
if($page['identifier'] == "home"){
echo  "<li><a href=\"$url\" title=\"".$page['title']."\">".$page['title']."</a></li>\n";
} else {
echo "<li><a href=\"$url".$page['identifier']."\" title=\"".$page['title']."\">".$page['title']."</a></li>\n";
}
endforeach;




0 komentar:

Post a Comment

Get All Cms Page in magento