gosteev
2/25/2017 - 2:43 PM

creating cms page via upgrade script in magento 1

creating cms page via upgrade script in magento 1

<?php
$identifier = "how-to/investing-in-physical-metals";
$cmsPageData = array(
    'title' => 'Investing In Physical Metals',
    'root_template' => 'one_column',
    'meta_keywords' => '',
    'meta_description' => '',
    'identifier' => $identifier,
    'content_heading' => '',
    'stores' => array(0),
    'content' => "{{block type=\"page/html\" name=\"learning_center_investing\" template=\"custom/learning_center_investing.phtml\"}}"
);

$pageId = Mage::getModel('cms/page')->checkIdentifier($identifier);

if (!$pageId) {
    Mage::getModel('cms/page')->setData($cmsPageData)->save();
}