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.
2 Answers
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();
?>
-
How do I run this installer script. I want such mechanism that if a layman user installs my theme on his magento installation, the homepage automatically gets 2-column layout, without his taking any action. Dec 3, 2013 at 12:25
-
1you need to create small module for it, when your theme install that module also install at that time. Dec 4, 2013 at 7:03
In the database there is an entity cms_page
. In root_template
column holds the default layout for each CMS Page like homepage and others.
So you can change all CMS pages default layout with sql query:
UPDATE cms_page SET root_tempate = "1-column.phtml"