We have a BETA site for proposed changes/updates that if approved will get moved to the PRODUCTION (LIVE) site. Is there an option/extension that will automate those changes rather than having to log and apply the same changes from BETA to LIVE manually?

  • Only thing you need to do is change the base url in DB and update local.xml file with credentials right? And clearing cache and sessions. – Kalpesh Sep 19 '14 at 18:28
  • What type of changes/updates do your make o the BETA site development such as add modules/update design or admin changes such as add edit product. Also see magento.stackexchange.com/questions/252/… – Renon Stewart Sep 19 '14 at 19:04
  • Creating static blocks, updating content on certain pages, etc. We will use GIT or equivalent for system file changes, but we are looking for for changes done within the Magento interface. – Jeff Sep 19 '14 at 19:10

I have to work this way daily to keep various servers in sync. The trick is to make a module with upgrade scripts. Let's pretend you have this module:

app/code/local/Jeff/Content/etc/config.xml

<config>
    <modules>
        <Jeff_Content>
            <!-- keep this number in mind -->
            <version>1.0.0</version>
        </Jeff_Content>
    </modules>
    <global>
        <resources>
            <!-- this name is used for a folder next -->
            <jeffcontent_setup>
                <setup>
                    <module>Jeff_Content</module>
                </setup>
            </jeffcontent_setup>
        </resources>
    </global>
</config>

app/code/local/Jeff/Content/data/jeffcontent_setup/data-install-1.0.0.php

<?php

/* @var $this Mage_Core_Model_Resource_Setup */
$this->startSetup();

Mage::getModel('cms/block')
    ->setIdentifier('example_block_id')
    ->setTitle('Example Block Title')
    ->setContent('Example block content goes here.')
    ->setIsActive(true)
    ->setStores(array(0))
    ->save();

$this->endSetup();

The first time each site sees this module (ie. after their config cache is refreshed) they'll run the above script once, adding a new block. For a second script change the version number in config.xml to 1.0.1 and create app/code/local/Jeff/Content/data/jeffcontent_setup/data-upgrade-1.0.0-1.0.1.php.

These scripts may contain any type of content you wish such as; CMS pages, products, categories, attributes, attribute sets, promotions, etc. A favourite of mine is changing configuration values, useful when setting a default value in XML won't work.

$this->startSetup();

Mage::getModel('core/config_data')
    ->setPath('design/package/name')
    ->setValue('custom_design')
    ->save();

$this->endSetup();

This is perfectly suited for git as long as you keep going forwards. If you rollback a commit after it has been deployed the change doesn't get undone, sadly. (This is being addressed in Magento2)

Depending on your git hosting setup you can then clear the cache by webhook so there is no admin interaction at all.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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