示例#1
0
 /**
  * Returns true if next discount rate is available for cart
  *
  * @return boolean
  */
 protected function hasNextDiscount()
 {
     if (null === $this->nextDiscount) {
         $this->nextDiscount = $this->getNextDiscount();
         if (null !== $this->nextDiscount) {
             $nextValue = $this->getCart()->getCurrency()->formatValue($this->nextDiscount->getAmount($this->getCart()));
             $currentValue = 0;
             if (0 < $nextValue) {
                 $currentDiscount = $this->getCurrentDiscount();
                 if ($currentDiscount) {
                     $currentValue = $this->getCart()->getCurrency()->formatValue($currentDiscount->getAmount($this->getCart()));
                 }
             }
             if ($nextValue <= $currentValue) {
                 $this->nextDiscount = null;
             }
         }
     }
     return null !== $this->nextDiscount;
 }
 /**
  * {@inheritDoc}
  */
 public function getAmount(\XLite\Model\Order $order)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAmount', array($order));
     return parent::getAmount($order);
 }