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.

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();
?>
  • 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. – anwartheravian Dec 3 '13 at 12:25
  • 1
    you need to create small module for it, when your theme install that module also install at that time. – Bijal Bhavsar Dec 4 '13 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, privacy policy and cookie policy

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