Skip to content

Instantly share code, notes, and snippets.

@versedi
Created December 29, 2016 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save versedi/37e112aded5b83e36effdf4f3265b53c to your computer and use it in GitHub Desktop.
Save versedi/37e112aded5b83e36effdf4f3265b53c to your computer and use it in GitHub Desktop.
Activate coupons sale rules by specific expiration date.
<?php
$collection = Mage::getModel('salesrule/coupon')->getCollection()->addFieldToFilter('expiration_date', array('eq' => '2016-12-30 00:00:00'));
foreach($collection as $coupon) {
$rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
$rule->setIsActive(true)->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment