Пример #1
0
 /**
  * Check quote amount
  *
  * @param Mage_Sales_Model_Quote $quote
  * @param decimal $amount
  * @return Mage_Sales_Helper_Data
  */
 public function checkQuoteAmount(Mage_Sales_Model_Quote $quote, $amount)
 {
     if (!$quote->getHasError() && $amount >= self::MAXIMUM_AVAILABLE_NUMBER) {
         $quote->setHasError(true);
         $quote->addMessage($this->__('Items maximum quantity or price do not allow checkout.'));
     }
     return $this;
 }
Пример #2
0
 public function checkQuoteAmount(Mage_Sales_Model_Quote $quote, $amount)
 {
     if (!$quote->getHasError() && $amount >= self::MAXIMUM_AVAILABLE_NUMBER) {
         $quote->setHasError(true);
         $quote->addMessage($this->__('Some items have quantities exceeding allowed quantities. Please select a lower quantity to checkout.'));
     }
     return $this;
 }
Пример #3
0
 /**
  * Declare quote model object
  *
  * @param   Mage_Sales_Model_Quote $quote
  * @return  Mage_Sales_Model_Quote_Item
  */
 public function setQuote(Mage_Sales_Model_Quote $quote)
 {
     $this->_quote = $quote;
     if ($this->getHasError()) {
         $quote->setHasError(true);
     }
     $quote->addMessage($this->getQuoteMessage(), $this->getQuoteMessageIndex());
     return $this;
 }
Пример #4
0
 /**
  * Check max amount on cart
  *
  * @param Mage_Sales_Model_Quote $quote
  */
 public function checkCartMaxAmount($quote)
 {
     $quoteStore = $quote->getStore();
     if ($this->isCartEnable($quoteStore)) {
         $maxAmount = $this->getCartMaxAmount($quoteStore);
         $grandTotal = $quote->getGrandTotal();
         if ($grandTotal > $maxAmount) {
             $formater = new Varien_Filter_Template();
             $formater->setVariables(array('amount' => Mage::helper('core')->currency($maxAmount, true, false)));
             $format = $this->getCartMessage($quoteStore);
             //	hold checkout
             $quote->setHasError(true)->addMessage($formater->filter($format));
         }
     }
 }