1

I want add new theme with magento shell script. I think it's possible with direct access to MySQL 'design_change' table. But I don't know how to do it. Any ideas?

asked Sep 21, 2015 at 21:31

2 Answers 2

2

First you need to create theme in file-level

Then using below query for applying the theme into your store

INSERT INTO 'design_change' ('design_change_id', 'store_id', 'design', 'date_from', 'date_to') VALUES ('', 'STORE_ID', 'packageName/ThemeName', 'Starting_date', 'END_Date');

enter image description here Here

  • design_change_id should be blank as it primary key.
  • store_id is the store id of your store where you want to apply the the theme.
  • packageName is the package of theme which is located at app/design/{area}/{packageName}. ThemeName is the name of theme which will be point to the location app/design/{area}/{packageName}/{ThemeName}. Magento skin folder location should be skin/{area}/{packageName}/{ThemeName}.
  • date_from is the starting date of applying theme
  • date_to end date of applying theme

Shell Script:

If you want do this using shell php script then try below code:

<?PHP
require_once "YOUR_MAGENTO_DIR/app/Mage.php";
umask(0);
Mage::app('admin');
$design = Mage::getModel('core/design');
 $design->setData('store_id','STORE_ID');
 $design->setData('design','packageName/ThemeName');
 $design->setData('date_from','YYYY-MM_DD');
 $design->setData('date_to','YYYY-MM_DD');
try {
 $design->save();
 echo 'The design change has been saved.';
} catch (Exception $e){
 $e->getMessage();
}
answered Sep 22, 2015 at 1:51
0

If by a Shell script you mean, a means to do such via Shell with a boot strapped Magento and not just a raw bash script or such.

Familiarize yourself with:

It is the same scripts that can be executed via php -f shell/file.php -- somearguments

Using Amit's SQL should work or you can utilize the framework with the shell abstract mentioned.

answered Sep 22, 2015 at 2:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.