doug48
8/12/2015 - 1:48 PM

update a cms page with update script

update a cms page with update script

<?php
/**
 * update the home cms page for victoria (store 4)
 */

$content = <<<EOD
{{block type="core/template" name="finance-strapline" template="page/html/home-strapline.phtml"}}

{{block type="bbpromopopup/deals" name="megadeals" as="megadeals" template="space48/megadeals/megadeals.phtml"}}
{{block type="bbcategs/catalog_category_list" name="homecategories" as="homecategories" template="betterbathrooms/categorypages/homecategories.phtml"}}
EOD;

$data = array(
    'identifier'            => 'home',
    'root_template'         => 'one_column',
    'stores'                => array(4),
    'content'               => $content,
);

try {
    $page = Mage::getModel('cms/page');

    $id = $page->checkIdentifier($data['identifier'], 4);

    if ( $id ) {
        $page->setData($data)->setId($id)->save();
    } else {
        $page->setData($data)->save();
    }
} catch (Exception $e) {
    // do nothing
}