Skip to content

Instantly share code, notes, and snippets.

@Sleavely
Last active November 22, 2018 16:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Sleavely/49acd6c466ecf066dce9 to your computer and use it in GitHub Desktop.
Save Sleavely/49acd6c466ecf066dce9 to your computer and use it in GitHub Desktop.
Programmatically apply catalog price rules in Magento
<?php
ini_set('display_errors', '1');
error_reporting(E_ALL);
// Bootstrap Magento
require '../magento/app/Mage.php';
Mage::app('admin', 'store');
try{
$catalogPriceRule = Mage::getModel('catalogrule/rule');
$catalogPriceRule->applyAll();
} catch (Exception $e) {
die($e);
}
// GLHF
@seansan
Copy link

seansan commented Aug 28, 2018

Idea to add? Mage::app()->removeCache('catalog_rules_dirty');

@seansan
Copy link

seansan commented Aug 28, 2018

Also. What store rally needs to be loaded I have seen Mage::app('admin', 'store'); and Mage::app('default');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment