Exemple #1
0
 /**
  * Removes the result of a coupon from the order base instance.
  *
  * @param MShop_Order_Item_Base_Interface $base Basic order of the customer
  */
 public function deleteCoupon(MShop_Order_Item_Base_Interface $base)
 {
     $base->deleteCoupon($this->_code, true);
 }
Exemple #2
0
 /**
  * Migrates the coupons from the old basket to the current one.
  *
  * @param MShop_Order_Item_Base_Interface $basket Basket object
  * @param array $errors Associative list of previous errors
  * @param string $localeKey Unique identifier of the site, language and currency
  * @return array Associative list of errors occured
  */
 private function _copyCoupons(MShop_Order_Item_Base_Interface $basket, array $errors, $localeKey)
 {
     foreach ($basket->getCoupons() as $code => $list) {
         try {
             $this->addCoupon($code);
             $basket->deleteCoupon($code, true);
         } catch (Exception $e) {
             $logger = $this->_getContext()->getLogger();
             $str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
             $logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), MW_Logger_Abstract::INFO);
             $errors['coupon'][$code] = $e->getMessage();
         }
     }
     return $errors;
 }