0

There are many themes which offer Quick installation or 1 click installer which not only activates the theme but also installs the Sample data (same as shown on theme demo). My Question is how can we add that functionality in our theme?

Some themes offering this feature are this and this

3 Answers 3

1

To install any data or settings (like sample data, products etc) your theme would not a module as well that has an installer script. Inchoo wrote a nice article on installers that should help you set this up, also take a look at this tutorial.

For example, setting your template as active might look something like this

$installer = $this;

$installer->startSetup();

$installer->run("
UPDATE `{$this->getTable('core_config_data')}` SET `value` = 'yourpackagename' WHERE `path` = 'design/package/name';
UPDATE `{$this->getTable('core_config_data')}` SET `value` = 'yourtemplatename' WHERE `path` = 'design/theme/template';
");

$installer->endSetup();
0

Instead of using an installer executing some SQL query, I would recommend to use instead the function saveConfig, exactly buit for this. A quick example here :

$installer = $this;
$installer->startSetup();
$setup = new Mage_Core_Model_Config();
$setup->saveConfig('design/package/name', 'yourpackagename');
$installer->endSetup();
0
sudo php bin/magento sampledata:deploy

Run this command in magento root dir.

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.