示例#1
0
 /**
  * Open Invoice DE is not available if quote has a coupon
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return boolean
  */
 public function isAvailable($quote = null)
 {
     /* availability depends on quote */
     if (false == $quote instanceof Mage_Sales_Model_Quote) {
         return false;
     }
     /* not available if quote contains a coupon and allow_discounted_carts is disabled */
     if (!$this->isAvailableForDiscountedCarts() && $quote->getSubtotal() != $quote->getSubtotalWithDiscount()) {
         return false;
     }
     /* not available if there is no gender or no birthday */
     if (is_null($quote->getCustomerGender()) || is_null($quote->getCustomerDob())) {
         return false;
     }
     return parent::isAvailable($quote);
 }
 /**
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 protected function isRequiredForQuote(Mage_Sales_Model_Quote $quote)
 {
     $config = $this->getConfig();
     $quoteTotal = $quote->getSubtotal();
     /** @var $method Payone_Core_Model_Config_Payment_Method_Interface */
     $maxOrderTotal = $config->getMaxOrderTotal();
     $minOrderTotal = $config->getMinOrderTotal();
     if (!empty($maxOrderTotal) and $maxOrderTotal < $quoteTotal) {
         return false;
         // quote total too high.
     }
     if (!empty($minOrderTotal) and $minOrderTotal > $quoteTotal) {
         return false;
         // quote total is too low.
     }
     return true;
 }
示例#3
0
 /**
  * @param \Vbw\Procurement\Punchout\Order $poOrder
  * @param Mage_Sales_Model_Quote $quote
  */
 public function addTotal($poOrder, $quote)
 {
     $configHelper = Mage::helper('vbw_punchout/config');
     /**@var $dataHelper Vbw_Punchout_Helper_Data*/
     $dataHelper = Mage::helper('vbw_punchout/data');
     /** @var $body \Vbw\Procurement\Punchout\Order\Body */
     $body = $poOrder->getBody();
     $totals = $quote->getTotals();
     $total = $quote->getSubtotal();
     if ($configHelper->getconfig('order/include_discount')) {
         if (isset($totals['discount'])) {
             $shippingTotal = $totals['discount']->getValue();
             $total += $shippingTotal;
         }
     }
     if ($configHelper->getconfig('order/include_shipping')) {
         if (isset($totals['shipping'])) {
             $shippingTotal = $totals['shipping']->getValue();
             $total += $shippingTotal;
         }
     }
     if ($configHelper->getconfig('order/include_tax')) {
         if (isset($totals['tax'])) {
             $taxTotal = $totals['tax']->getValue();
             $total += $taxTotal;
         }
     }
     $body->setTotal($dataHelper->getAsStoreCurrency($total));
 }
示例#4
0
 /**
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return Bronto_Common_Model_Email_Template_Filter
  */
 protected function _filterQuote(Mage_Sales_Model_Quote $quote)
 {
     if (!in_array('quote', $this->_filteredObjects)) {
         $this->setStoreId($quote->getStoreId());
         $currencyCode = $quote->getQuoteCurrencyCode();
         if (Mage::helper('bronto_common')->displayPriceIncTax($quote->getStoreId())) {
             $totals = $quote->getTotals();
             $this->setField('subtotal', $this->formatPrice($totals['subtotal']->getValue(), $currencyCode));
             $this->setField('grandTotal', $this->formatPrice($totals['grand_total']->getValue(), $currencyCode));
         } else {
             $this->setField('subtotal', $this->formatPrice($quote->getSubtotal(), $currencyCode));
             $this->setField('grandTotal', $this->formatPrice($quote->getGrandTotal(), $currencyCode));
         }
         $index = 1;
         foreach ($quote->getAllItems() as $item) {
             if (!$item->getParentItem()) {
                 $this->_filterQuoteItem($item, $index);
                 $index++;
             }
         }
         // Add Related Content
         $this->_items = $quote->getAllItems();
         $queryParams = $this->getQueryParams();
         $queryParams['id'] = urlencode(base64_encode(Mage::helper('core')->encrypt($quote->getId())));
         if ($store = $this->getStore()) {
             $this->setField('quoteURL', $store->getUrl('reminder/load/index', $queryParams));
         } else {
             $this->setField('quoteURL', Mage::getUrl('reminder/load/index', $queryParams));
         }
         // Setup quote items as a template
         if (class_exists('Bronto_Reminder_Block_Cart_Items', false)) {
             $layout = Mage::getSingleton('core/layout');
             /* @var $items Mage_Sales_Block_Items_Abstract */
             $items = $layout->createBlock('bronto/bronto_reminder_cart_items', 'items');
             $items->setTemplate('bronto/reminder/items.phtml');
             $items->setQuote($item->getQuote());
             $this->_respectDesignTheme();
             $this->setField("cartItems", $items->toHtml());
         }
         $this->_filteredObjects[] = 'quote';
     }
     return $this;
 }