本文整理汇总了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;
}
示例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());
}
}
}
示例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;
}