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


PHP Mage_Sales_Model_Quote_Address::getTotalAmount方法代码示例

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


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

示例1: fetch

 /**
  * Update the address with totals data used for display in a total line,
  * e.g. a total line in the cart.
  *
  * @param Mage_Sales_Model_Quote_Address
  * @return self
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $total = $address->getTotalAmount($this->getCode());
     if ($total) {
         $address->addTotal(['code' => $this->getCode(), 'title' => $this->_helper->__(self::TAX_TOTAL_TITLE), 'value' => $total]);
     }
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:15,代码来源:Tax.php

示例2: _addSubtotalAmount

 /**
  * Add row total item amount to subtotal
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  *
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _addSubtotalAmount(Mage_Sales_Model_Quote_Address $address, $item)
 {
     if ($this->_config->priceIncludesTax($this->_store)) {
         $subTotal = $item->getRowTotalInclTax() - $item->getRowTax();
         $baseSubTotal = $item->getBaseRowTotalInclTax() - $item->getBaseRowTax();
         $address->setTotalAmount('subtotal', $address->getTotalAmount('subtotal') + $subTotal);
         $address->setBaseTotalAmount('subtotal', $address->getBaseTotalAmount('subtotal') + $baseSubTotal);
     } else {
         $address->setTotalAmount('subtotal', $address->getTotalAmount('subtotal') + $item->getRowTotal());
         $address->setBaseTotalAmount('subtotal', $address->getBaseTotalAmount('subtotal') + $item->getBaseRowTotal());
     }
     $address->setSubtotalInclTax($address->getSubtotalInclTax() + $item->getRowTotalInclTax());
     $address->setBaseSubtotalInclTax($address->getBaseSubtotalInclTax() + $item->getBaseRowTotalInclTax());
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:23,代码来源:Subtotal.php

示例3: _roundTotals

 /**
  * Round the total amounts in address
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Mage_Tax_Model_Sales_Total_Quote_Tax
  */
 protected function _roundTotals(Mage_Sales_Model_Quote_Address $address)
 {
     // initialize the delta to a small number to avoid non-deterministic behavior with rounding of 0.5
     $totalDelta = 1.0E-6;
     $baseTotalDelta = 1.0E-6;
     /*
      * The order of rounding is import here.
      * Tax is rounded first, to be consistent with unit based calculation.
      * Hidden tax and shipping_hidden_tax are rounded next, which are really part of tax.
      * Shipping is rounded before subtotal to minimize the chance that subtotal is
      * rounded differently because of the delta.
      * Here is an example: 19.2% tax rate, subtotal = 49.95, shipping = 9.99, discount = 20%
      * subtotalExclTax = 41.90436, tax = 7.7238, hidden_tax = 1.609128, shippingPriceExclTax = 8.38087
      * shipping_hidden_tax = 0.321826, discount = -11.988
      * The grand total is 47.952 ~= 47.95
      * The rounded values are:
      * tax = 7.72, hidden_tax = 1.61, shipping_hidden_tax = 0.32,
      * shipping = 8.39 (instead of 8.38 from simple rounding), subtotal = 41.9, discount = -11.99
      * The grand total calculated from the rounded value is 47.95
      * If we simply round each value and add them up, the result is 47.94, which is one penny off
      */
     $totalCodes = array('tax', 'hidden_tax', 'shipping_hidden_tax', 'shipping', 'subtotal', 'weee', 'discount');
     foreach ($totalCodes as $totalCode) {
         $exactAmount = $address->getTotalAmount($totalCode);
         $baseExactAmount = $address->getBaseTotalAmount($totalCode);
         if (!$exactAmount && !$baseExactAmount) {
             continue;
         }
         $roundedAmount = $this->_calculator->round($exactAmount + $totalDelta);
         $baseRoundedAmount = $this->_calculator->round($baseExactAmount + $baseTotalDelta);
         $address->setTotalAmount($totalCode, $roundedAmount);
         $address->setBaseTotalAmount($totalCode, $baseRoundedAmount);
         $totalDelta = $exactAmount + $totalDelta - $roundedAmount;
         $baseTotalDelta = $baseExactAmount + $baseTotalDelta - $baseRoundedAmount;
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:43,代码来源:Tax.php

示例4: _addSubtotalAmount

 /**
  * Add row total item amount to subtotal
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _addSubtotalAmount(Mage_Sales_Model_Quote_Address $address, $item)
 {
     $address->setTotalAmount('subtotal', $address->getTotalAmount('subtotal') + $item->getRowTotal());
     $address->setBaseTotalAmount('subtotal', $address->getBaseTotalAmount('subtotal') + $item->getBaseRowTotal());
     $address->setSubtotalInclTax($address->getSubtotalInclTax() + $item->getRowTotalInclTax());
     $address->setBaseSubtotalInclTax($address->getBaseSubtotalInclTax() + $item->getBaseRowTotalInclTax());
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:15,代码来源:Subtotal.php


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