예제 #1
0
파일: Filter.php 프로젝트: bevello/bevello
 /**
  * @param Mage_Sales_Model_Quote_Item $item
  * @param int                         $index
  *
  * @return Bronto_Common_Model_Email_Template_Filter
  */
 protected function _filterQuoteItem($item, $index = null)
 {
     if ($item->getParentItem()) {
         return $this;
     }
     if (Mage::helper('bronto_common')->displayPriceIncTax($item->getStore())) {
         $checkout = Mage::helper('checkout');
         $this->setField("productPrice_{$index}", $this->formatPrice($checkout->getPriceInclTax($item)));
         $this->setField("productTotal_{$index}", $this->formatPrice($checkout->getSubtotalInclTax($item)));
     } else {
         $this->setField("productPrice_{$index}", $this->formatPrice($item->getPrice()));
         $this->setField("productTotal_{$index}", $this->formatPrice($item->getRowTotal()));
     }
     $this->setField("productName_{$index}", $item->getName());
     $this->setField("productSku_{$index}", $item->getSku());
     $this->setField("productQty_{$index}", $item->getQty());
     $this->setField("productUrl_{$index}", $this->_getQuoteItemUrl($item));
     /* @var $product Mage_Catalog_Model_Product */
     $product = $item->getProduct();
     if (!$product) {
         $product = Mage::helper('bronto_common/product')->getProduct($item->getProductId(), $this->getStoreId());
     }
     $this->_filterProduct($product, $index);
     return $this;
 }
예제 #2
0
 /**
  * Check max amount after adding product to cart
  *
  * @param Mage_Sales_Model_Quote_Item $quoteItem
  */
 public function checkProductmaxAmount($quoteItem)
 {
     $quoteStore = $quoteItem->getStore();
     if ($this->isProductEnable($quoteStore)) {
         $maxAmount = $this->getCartMaxAmount($quoteStore);
         /* @var $quote Mage_Sales_Model_Quote */
         $quote = $quoteItem->getQuote();
         $grandTotal = $quote->getGrandTotal();
         $_product = Mage::getModel('catalog/product')->load($quoteItem->getProduct()->getId());
         $grandTotal += $_product->getFinalPrice($quoteItem->getQty());
         if ($grandTotal > $maxAmount) {
             $formater = new Varien_Filter_Template();
             $formater->setVariables(array('amount' => Mage::helper('core')->currency($maxAmount, true, false)));
             $format = $this->getProductMessage($quoteStore);
             // throw exception for "remove" product to cart
             Mage::throwException($formater->filter($format));
         }
     }
 }