Magento Theme – Change Default Homepage Template

templatetheme

I'm creating a new magento theme. The theme is almost ready, but their is one problem. Currently when the theme is applied to a new installation of magento, the default homepage template is 2-columns layout, whereas I want it to have 1-column layout.
I know it can be changed from admin panel, but want to apply 1-column layout to every new theme install, without changing the admin panel.

Best Answer

Try to run below installer script to update root template of homepage:

<?php

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

$installer->startSetup();

$installer->run("
    UPDATE `{$this->getTable('cms_page')}` SET `root_template` = 'one_column' WHERE `identifier` = 'home' and `is_active` = 1;

");

$installer->endSetup();
?>
Related Topic