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


PHP Mage_Sales_Model_Quote_Address::addTotalAmount方法代码示例

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


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

示例1: _calculateShippingTax

 /**
  * Tax caclulation for shipping price
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   Varien_Object $taxRateRequest
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 protected function _calculateShippingTax(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
 {
     $taxRateRequest->setProductClassId($this->_config->getShippingTaxClass($this->_store));
     $rate = $this->_calculator->getRate($taxRateRequest);
     $inclTax = $address->getIsShippingInclTax();
     $shipping = $address->getShippingTaxable();
     $baseShipping = $address->getBaseShippingTaxable();
     $hiddenTax = null;
     $baseHiddenTax = null;
     switch ($this->_helper->getCalculationSequence($this->_store)) {
         case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
         case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
             $tax = $this->_calculator->calcTaxAmount($shipping, $rate, $inclTax, false);
             $baseTax = $this->_calculator->calcTaxAmount($baseShipping, $rate, $inclTax, false);
             break;
         case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
         case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
             $discountAmount = $address->getShippingDiscountAmount();
             $baseDiscountAmount = $address->getBaseShippingDiscountAmount();
             $tax = $this->_calculator->calcTaxAmount($shipping - $discountAmount, $rate, $inclTax, false);
             $baseTax = $this->_calculator->calcTaxAmount($baseShipping - $baseDiscountAmount, $rate, $inclTax, false);
             break;
     }
     if ($this->_config->getAlgorithm($this->_store) == Mage_Tax_Model_Calculation::CALC_TOTAL_BASE) {
         $tax = $this->_deltaRound($tax, $rate, $inclTax);
         $baseTax = $this->_deltaRound($baseTax, $rate, $inclTax, 'base');
     } else {
         $tax = $this->_calculator->round($tax);
         $baseTax = $this->_calculator->round($baseTax);
     }
     if ($inclTax && !empty($discountAmount)) {
         $hiddenTax = $shipping - $tax - $address->getShippingAmount();
         $baseHiddenTax = $baseShipping - $baseTax - $address->getBaseShippingAmount();
     }
     $this->_addAmount(max(0, $tax));
     $this->_addBaseAmount(max(0, $baseTax));
     $address->setShippingTaxAmount(max(0, $tax));
     $address->setBaseShippingTaxAmount(max(0, $baseTax));
     $address->setShippingHiddenTaxAmount(max(0, $hiddenTax));
     $address->setBaseShippingHiddenTaxAmount(max(0, $baseHiddenTax));
     $address->addTotalAmount('shipping_hidden_tax', $hiddenTax);
     $address->addBaseTotalAmount('shipping_hidden_tax', $baseHiddenTax);
     $applied = $this->_calculator->getAppliedRates($taxRateRequest);
     $this->_saveAppliedTaxes($address, $applied, $tax, $baseTax, $rate);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:53,代码来源:Tax.php

示例2: _processHiddenTaxes

 /**
  * Changed By Adam 06/11/2014: Fix bug hidden tax
  * @param Mage_Sales_Model_Quote_Address $address
  * @param type $address
  */
 protected function _processHiddenTaxes($address)
 {
     foreach ($address->getAllItems() as $item) {
         if ($item->getParentItemId()) {
             continue;
         }
         if ($item->getHasChildren() && $item->isChildrenCalculated()) {
             foreach ($item->getChildren() as $child) {
                 $child->setHiddenTaxAmount($child->getHiddenTaxAmount() + $child->getAffiliateplusHiddenTaxAmount());
                 $child->setBaseHiddenTaxAmount($child->getBaseHiddenTaxAmount() + $child->getAffiliateplusBaseHiddenTaxAmount());
                 $address->addTotalAmount('hidden_tax', $child->getAffiliateplusHiddenTaxAmount());
                 $address->addBaseTotalAmount('hidden_tax', $child->getAffiliateplusBaseHiddenTaxAmount());
             }
         } elseif ($item->getProduct()) {
             $item->setHiddenTaxAmount($item->getHiddenTaxAmount() + $item->getAffiliateplusHiddenTaxAmount());
             $item->setBaseHiddenTaxAmount($item->getBaseHiddenTaxAmount() + $item->getAffiliateplusBaseHiddenTaxAmount());
             $address->addTotalAmount('hidden_tax', $item->getAffiliateplusHiddenTaxAmount());
             $address->addBaseTotalAmount('hidden_tax', $item->getAffiliateplusBaseHiddenTaxAmount());
         }
     }
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:26,代码来源:Affiliateplusaftertax.php

示例3: _processTotalAmount

 /**
  * Proces row amount based on FPT total amount configuration setting
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   float $rowValue
  * @param   float $baseRowValue
  * @return  Mage_Weee_Model_Total_Quote_Weee
  */
 protected function _processTotalAmount($address, $rowValue, $baseRowValue)
 {
     if ($this->_helper->includeInSubtotal($this->_store)) {
         $address->addTotalAmount('subtotal', $rowValue);
         $address->addBaseTotalAmount('subtotal', $baseRowValue);
         $this->_isTaxAffected = true;
     } else {
         $address->setExtraTaxAmount($address->getExtraTaxAmount() + $rowValue);
         $address->setBaseExtraTaxAmount($address->getBaseExtraTaxAmount() + $baseRowValue);
     }
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:20,代码来源:Weee.php


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