Export Static Blocks Magento

This tutorial explains how to export static blocks Magento. Here I am showing how to export static blocks in CSV.

Export Static Blocks Magento
Export Static Blocks Magento

Export Static Blocks Magento

The following code export all the cms pages from Magento 1.

Initialise Script

require_once '../app/Mage.php';

ini_set('display_errors', 1);
Mage::app('admin');
Mage::setIsDeveloperMode(true);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
getCmsblocks();

Export Static Blocks

function getCmsblocks() {

    $blocks = Mage::getModel('cms/block')->getCollection();

    echo "block here".PHP_EOL;

    foreach ($blocks as $block) {

        echo 'Id : '.$block->getId().PHP_EOL;
        echo 'Title : '.$block->getTitle().PHP_EOL;
        echo 'Identifier : '.$block->getIdentifier().PHP_EOL;
        echo'Content : '.$block->getContent().PHP_EOL;
        echo'Status : '.$block->getIsActive().PHP_EOL;
        $storeIds= $block->getResource()->lookupStoreIds($block->getId());

        foreach($storeIds as $storeId){

            $store = Mage::getModel('core/store')->load($storeId);
            echo 'Store Name : '. $store->getName().PHP_EOL;
            echo 'Code : '. $store->getCode().PHP_EOL;
            echo 'Website Id : '. $store->getWebsiteId().PHP_EOL;
            echo 'Group Id : '. $store->getGroupId().PHP_EOL;
            echo 'Sort Order : '. $store->getSortOrder().PHP_EOL;
            echo '-----------------------------------------------'.PHP_EOL;
        }
        echo '-----------------------------------------------'.PHP_EOL;
    }



}

Check Also

VAOBET Casino Deposit: Secure and Seamless Transactions for Players

Making deposits at VAOBET Casino is designed to be fast, secure, and convenient, ensuring that …