Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save evgv/bb416d76e6a480c900f021b61ab876cd to your computer and use it in GitHub Desktop.

Select an option

Save evgv/bb416d76e6a480c900f021b61ab876cd to your computer and use it in GitHub Desktop.
Magento. Add static block programmatically within setup script

Add static block programmatically within setup script

    /* @var $installer Mage_Core_Model_Resource_Setup */
    $installer = $this;

    /* @var $connection Varien_Db_Adapter_Pdo_Mysql */
    $connection = $installer->getConnection();

    $installer->startSetup();
    $connection->insert($installer->getTable('cms/block'), array(
        'title'             => 'Blog introduction',  
        'identifier'        => 'blog-introduction',
        'content'           => 'Blog short introduction dolor sit amet, consectetur adipisicng elit, sed do eiusmod te,por incididunt ut labore dolore', // Any html
        'creation_time'     => now(),
        'update_time'       => now(),
    ));

    $connection->insert($installer->getTable('cms/block_store'), array(
        'block_id'   => $connection->lastInsertId(),
        'store_id'  => 0
    ));

    $installer->endSetup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment