2

Required database backup files with theme.

I have build custom theme but need to get all static block data as well as cms pages database script and other required layout updates with theme deployment.

Note: no need to get all database. only required tables and static block, cms pages and layout updates need for theme Deployment.

Any help welcome and get +1 if some help i will get.

3

Can you through how to instal date / time update. This way if you use it with custom theme, the first refresh Magento populate your database with CMS Blocs.


Create file and put the content: app/etc/modules/Namespace_SetUp.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_SetUp>
            <active>true</active>
            <codePool>local</codePool>
        </Namespace_SetUp>
    </modules>
</config>

Create file and put the content: app/code/local/Namespace/SetUp/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_SetUp>
            <version>1.0.1</version>
        </Namespace_SetUp>
    </modules>

    <global>
        <resources>
            <namespace_setup>
                <setup>
                    <module>Namespace_SetUp</module>
                </setup>
            </namespace_setup>
        </resources>
    </global>
</config>

Create file and put the content: app/code/local/Namespace/SetUp/data/namespace_setup/data-install-1.0.0.php

$installer = $this;
$installer->startSetup();

$cms_block_1 = 'lorem ipsum 1';
$cms_block_2 = 'lorem ipsum 2';

$blocks = array(
    array(
        'title' => 'CMS Block Title 1',
        'identifier' => 'cms_block_identifier_1',
        'content' => $cms_block_1,
        'stores' => 0,
        'is_active' => 1
    ),
    array(
        'title' => 'CMS Block Title 2',
        'identifier' => 'cms_block_identifier_2',
        'content' => $cms_block_2,
        'stores' => 0,
        'is_active' => 1
    )
);

foreach ($blocks as $block) {
    if (Mage::getModel('cms/block')->load($block['identifier'], 'identifier')->getId()) {
        Mage::getModel('cms/block')->load($block['identifier'], 'identifier')->setContent($block['content'])->save();
    }
    else {
        Mage::getModel('cms/block')->setData($block)->save();
    }
}

$installer->endSetup();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.