Magento 1.7.0.2. I need to check for a coupon code that the customer enters and then if the subtotal is over a given amount I need to change that rule so that I can cap the discount using another rule.
So far I can grab the current coupon as $coupon
by using a simple if statement:
if (strtolower($coupon) == 'mycoupon') {
But then it doesn't seem to matter what combination of code I use I can't get it to update the coupon to something else. Here's one method I tried:
$coupon = 'MYNEWCOUPON';
$getCoupon = Mage::getModel('salesrule/coupon')->load($coupon, 'code');
$rule = Mage::getModel('salesrule/rule')->load($getCoupon->getRuleId());
Any ideas what else I could do here?