Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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