/** * Save/delete coupon * * @return Mage_SalesRule_Model_Rule */ protected function _afterSave() { $couponCode = trim($this->getCouponCode()); if (strlen($couponCode) && $this->getCouponType() == self::COUPON_TYPE_SPECIFIC && !$this->getUseAutoGeneration()) { $this->getPrimaryCoupon()->setCode($couponCode)->setUsageLimit($this->getUsesPerCoupon() ? $this->getUsesPerCoupon() : null)->setUsagePerCustomer($this->getUsesPerCustomer() ? $this->getUsesPerCustomer() : null)->setExpirationDate($this->getToDate())->save(); } else { $this->getPrimaryCoupon()->delete(); } parent::_afterSave(); return $this; }
/** * Save rule labels after rule save and process product attributes used in actions and conditions * * @return Mage_SalesRule_Model_Rule */ protected function _afterSave() { if ($this->hasStoreLabels()) { $this->_getResource()->saveStoreLabels($this->getId(), $this->getStoreLabels()); } //Saving attributes used in rule $ruleProductAttributes = array_merge($this->_getUsedAttributes($this->getConditionsSerialized()), $this->_getUsedAttributes($this->getActionsSerialized())); if (count($ruleProductAttributes)) { $this->getResource()->setActualProductAttributes($this, $ruleProductAttributes); } return parent::_afterSave(); }
/** * Save/delete coupon * * @return Mage_SalesRule_Model_Rule */ protected function _afterSave() { return parent::_afterSave(); }
protected function _afterSave() { parent::_afterSave(); }