Skip to content

Instantly share code, notes, and snippets.

@vikramacharya
Created August 4, 2017 11:57
Show Gist options
  • Select an option

  • Save vikramacharya/3a6f8f3aa99f0f85ddd6d4b970c37329 to your computer and use it in GitHub Desktop.

Select an option

Save vikramacharya/3a6f8f3aa99f0f85ddd6d4b970c37329 to your computer and use it in GitHub Desktop.
Create CMS Block in Magento programatically
<?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