Skip to content

Instantly share code, notes, and snippets.

@herveguetin
Last active August 29, 2015 14:16
Show Gist options
  • Save herveguetin/61515cb5c712c5c96fed to your computer and use it in GitHub Desktop.
Save herveguetin/61515cb5c712c5c96fed to your computer and use it in GitHub Desktop.
Create a CMS block programmatically in Magento
<?php
$content = <<<EOD
Block Content line 1
Block Content line 2
EOD;
$cmsBlock = Mage::getModel('cms/block')->addData(
array(
'title' => 'Block Title',
'identifier' => 'block_identifier',
'stores' => array(0), // Available in all stores
'is_active' => '1',
'content' => $content,
)
);
$cmsBlock->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment