Skip to content

Instantly share code, notes, and snippets.

@fballiano
Created July 21, 2014 14:33
Show Gist options
  • Save fballiano/21fe55fe585271c36ccb to your computer and use it in GitHub Desktop.
Save fballiano/21fe55fe585271c36ccb to your computer and use it in GitHub Desktop.
Apply promotion rules, for Magento EE 1.13, CE 1.8
<?php
require_once 'app/Mage.php';
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
try {
Mage::getModel('catalogrule/rule')->applyAll();
Mage::getModel('catalogrule/flag')->loadSelf()
->setState(0)
->save();
Mage::app()->removeCache('catalog_rules_dirty');
echo Mage::helper('catalogrule')->__('The rules have been applied.');
} catch (Exception $e) {
echo Mage::helper('catalogrule')->__('Unable to apply rules.');
print_r($e);
print_r($e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment