1

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 2

1

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();
?>
2
  • 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
  • 1
    you need to create small module for it, when your theme install that module also install at that time. Dec 4, 2013 at 7:03
0

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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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