Created
August 4, 2017 11:57
-
-
Save vikramacharya/3a6f8f3aa99f0f85ddd6d4b970c37329 to your computer and use it in GitHub Desktop.
Create CMS Block in Magento programatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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