当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Quote_Address::getDiscountAmount方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getDiscountAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getDiscountAmount方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getDiscountAmount怎么用?PHP Mage_Sales_Model_Quote_Address::getDiscountAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Quote_Address的用法示例。


在下文中一共展示了Mage_Sales_Model_Quote_Address::getDiscountAmount方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addressToOrder

 /**
  * Convert quote address model to order
  *
  * @param   Mage_Sales_Model_Quote $quote
  * @return  Mage_Sales_Model_Order
  */
 public function addressToOrder(Mage_Sales_Model_Quote_Address $address, $order = null)
 {
     if (!$order instanceof Mage_Sales_Model_Order) {
         $order = $this->toOrder($address->getQuote());
     }
     $order->setWeight($address->getWeight())->setShippingMethod($address->getShippingMethod())->setShippingDescription($address->getShippingDescription())->setShippingRate($address->getShippingRate())->setSubtotal($address->getSubtotal())->setTaxAmount($address->getTaxAmount())->setDiscountAmount($address->getDiscountAmount())->setShippingAmount($address->getShippingAmount())->setGiftcertAmount($address->getGiftcertAmount())->setCustbalanceAmount($address->getCustbalanceAmount())->setGrandTotal($address->getGrandTotal())->setBaseSubtotal($address->getBaseSubtotal())->setBaseTaxAmount($address->getBaseTaxAmount())->setBaseDiscountAmount($address->getBaseDiscountAmount())->setBaseShippingAmount($address->getBaseShippingAmount())->setBaseGiftcertAmount($address->getBaseGiftcertAmount())->setBaseCustbalanceAmount($address->getBaseCustbalanceAmount())->setBaseGrandTotal($address->getBaseGrandTotal());
     Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address' => $address, 'order' => $order));
     return $order;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:15,代码来源:Quote.php

示例2: fetch

 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         $title = Mage::helper('sales')->__('Discount');
         if ($code = $address->getQuote()->getCouponCode()) {
             $title = Mage::helper('sales')->__('Discount (%s)', $code);
         }
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => -$amount));
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:12,代码来源:Discount.php

示例3: fetchTotals

 public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         $title = AO::helper('sales')->__('Discount');
         if ($address->getQuote()->getCouponCode()) {
             $title .= ' (' . $address->getQuote()->getCouponCode() . ')';
         }
         $address->addTotal(array('code' => 'discount', 'title' => $title, 'value' => -$amount));
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:12,代码来源:Entity_Quote_Address_Attribute_Frontend_Discount.php

示例4: fetchTotals

 /**
  * Fetch discount
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Mage_Sales_Model_Resource_Quote_Address_Attribute_Frontend_Discount
  */
 public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         $title = Mage::helper('Mage_Sales_Helper_Data')->__('Discount');
         if ($address->getQuote()->getCouponCode()) {
             $title .= sprintf(' (%s)', $address->getQuote()->getCouponCode());
         }
         $address->addTotal(array('code' => 'discount', 'title' => $title, 'value' => -$amount));
     }
     return $this;
 }
开发者ID:relue,项目名称:magento2,代码行数:18,代码来源:Discount.php

示例5: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $store = $address->getQuote()->getStore();
     $session = Mage::getSingleton('checkout/session');
     $discount = $session->getData('webpos_admin_discount');
     if (!$discount) {
         return $this;
     }
     $items = $address->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $session->setData('webpos_admin_discount', $discount);
     $address->setWebposDiscountAmount($discount);
     $address->setData('webpos_discount_amount', $discount);
     /* Daniel - tax for discount */
     $afterDiscount = Mage::getStoreConfig('tax/calculation/apply_after_discount');
     if ($afterDiscount) {
         $country = Mage::getModel('checkout/session')->getQuote()->getShippingAddress()->getCountry();
         $oldTax = $address->getTaxAmount();
         $oldBaseTax = $address->getBaseTaxAmount();
         if ($country) {
             $rateTax = Mage::getModel('tax/calculation_rate')->getCollection()->addFieldToFilter('tax_country_id', $country)->setOrder('rate', 'DESC')->getFirstItem();
             $address->setTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100)->setBaseTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100);
             $taxCalculationModel = Mage::getSingleton('tax/calculation');
             $request = Mage::getSingleton('tax/calculation')->getRateRequest($address, $address->getQuote()->getBillingAddress(), $address->getQuote()->getCustomerTaxClassId(), $store);
             $rate = Mage::getSingleton('tax/calculation')->getRate($request);
             $this->_saveAppliedTaxes($address, $taxCalculationModel->getAppliedRates($request), $address->getTaxAmount(), $address->getBaseTaxAmount(), $rate);
         }
         $address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
     } else {
         $address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
     }
     /* end */
     return $this;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:38,代码来源:Discount.php

示例6: fetch

 /**
  * Add discount/surcharge total information to address
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_SalesRule_Model_Quote_Discount
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getDiscountAmount();
     $part = Mage::helper('aitloyalty/discount')->getTitlePart($amount);
     if ($amount != 0) {
         $description = $address->getDiscountDescription();
         if ($description) {
             $title = Mage::helper('sales')->__($part . ' (%s)', $description);
         } else {
             $title = Mage::helper('sales')->__($part);
         }
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => $amount, 'full_info' => $address->getFullDescr()));
     }
     return $this;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:21,代码来源:Discount.php

示例7: fetch

 /**
  * Add discount total information to address
  * Added 'off first payment only' message for discount
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_SalesRule_Model_Quote_Discount
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $add_message = Mage::helper('pixopc')->getDiscountDetails();
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         $description = $address->getDiscountDescription();
         if (strlen($description)) {
             $title = Mage::helper('sales')->__('Coupon: %s', $description);
         } else {
             $title = Mage::helper('sales')->__('Coupon');
         }
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => Mage::helper('checkout')->formatPrice($amount) . $add_message));
     }
     return $this;
 }
开发者ID:Rodrifer,项目名称:candyclub,代码行数:22,代码来源:Discount.php

示例8: fetch

 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         if ($amount > 0) {
             $title = Mage::helper('sales')->__('Discount');
         } else {
             $title = Mage::helper('sales')->__('Surcharge');
         }
         if ($code = $address->getCouponCode()) {
             if ($amount > 0) {
                 $title = Mage::helper('sales')->__('Discount (%s)', $code);
             } else {
                 $title = Mage::helper('sales')->__('Surcharge (%s)', $code);
             }
         }
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => -$amount, 'full_info' => $address->getFullDescr()));
     }
     return $this;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:20,代码来源:FrontSalesQuoteAddressTotalDiscount.php

示例9: fetch

 /**
  * Add discount total information to address
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_SalesRule_Model_Quote_Discount
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         $description = $address->getDiscountDescription();
         if (strlen($description)) {
             $title = Mage::helper('sales')->__('Discount (%s)', $description);
         } else {
             $title = Mage::helper('sales')->__('Discount');
         }
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => $amount));
     }
     return $this;
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:20,代码来源:Discount.php

示例10: calculateCartTotal

 /**
  * Calculate cart total net
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return int
  */
 private function calculateCartTotal($address)
 {
     if ($address->getTaxAmount() > 0) {
         $value = $address->getGrandTotal() - $address->getTaxAmount();
         return $this->currencyToSmallerUnit($value);
     } else {
         $discount = $address->getDiscountAmount() < 0 ? -$address->getDiscountAmount() : $address->getDiscountAmount();
         $value = $address->getSubtotal() + $address->getShippingAmount() + $this->getQuote()->getBillpayChargedFeeNet() - $discount;
         // TODO: for rate payment add fee tax amount
         return $this->currencyToSmallerUnit($value);
     }
 }
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:18,代码来源:Api.php


注:本文中的Mage_Sales_Model_Quote_Address::getDiscountAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。