I want to add a static block programmatically. The way I'm trying to do that is next:
- I created file
data-upgrade-1.0.0-1.0.1.php
(there were none other files except data-install...) inside setup directoryapp\code\local\[theme]\Customizations\data\[theme]_customizations_setup
- Added this code:
$stores = Mage::getModel('core/store')->getCollection() ->addFieldToFilter('store_id', array('gt' => 0))->getAllIds(); foreach ($stores as $storeId) { $block = Mage::getModel('cms/block') ->setIsActive(1) ->setTitle('Test CMS Static Block') ->setIdentifier('cms_block_test') ->setContent('<!-- edit me -->') ->setStores(array($storeId)) ->save(); }
- After that, I changed
config.xml
version 1.0.1 - Cleared all Magento cache
But my static block won't show under CMS > Static Blocks.
Am I missing something?
data-install-1.0.0.php
run in the first place?core_resource
table.