本文整理汇总了PHP中Mage_Tax_Model_Config::applyTaxAfterDiscount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Tax_Model_Config::applyTaxAfterDiscount方法的具体用法?PHP Mage_Tax_Model_Config::applyTaxAfterDiscount怎么用?PHP Mage_Tax_Model_Config::applyTaxAfterDiscount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Tax_Model_Config
的用法示例。
在下文中一共展示了Mage_Tax_Model_Config::applyTaxAfterDiscount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyTaxAfterDiscount
/**
* Check what taxes should be applied after discount
*
* @param Mage_Core_Model_Store|int $store
* @return bool
*/
public function applyTaxAfterDiscount($store = null)
{
if ($this->_getDataHelper()->isServiceEnabled($store)) {
if (!$this->_getTaxDataHelper()->priceIncludesTax($store)) {
return true;
}
}
return parent::applyTaxAfterDiscount($store);
}
示例2: _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)
{
$store = $address->getQuote()->getStore();
$shippingTaxClass = $this->_config->getShippingTaxClass($store);
$shippingAmount = $address->getShippingAmount();
$baseShippingAmount = $address->getBaseShippingAmount();
$shippingDiscountAmount = $address->getShippingDiscountAmount();
$baseShippingDiscountAmount = $address->getBaseShippingDiscountAmount();
/**
* Subtract discount before calculate tax amount
*/
if ($this->_config->applyTaxAfterDiscount($store)) {
$calcAmount = $shippingAmount - $shippingDiscountAmount;
$baseCalcAmount = $baseShippingAmount - $baseShippingDiscountAmount;
} else {
$calcAmount = $shippingAmount;
$baseCalcAmount = $baseShippingAmount;
}
$shippingTax = 0;
$shippingBaseTax = 0;
if ($shippingTaxClass) {
$taxRateRequest->setProductClassId($shippingTaxClass);
$rate = $this->_calculator->getRate($taxRateRequest);
if ($rate) {
if ($this->_config->shippingPriceIncludesTax($store) && $this->_areTaxRequestsSimilar) {
$shippingTax = $this->_calculator->calcTaxAmount($calcAmount, $rate, true);
$shippingBaseTax = $this->_calculator->calcTaxAmount($baseCalcAmount, $rate, true);
$shippingAmount -= $shippingTax;
$baseShippingAmount -= $shippingBaseTax;
} else {
$shippingTax = $this->_calculator->calcTaxAmount($calcAmount, $rate);
$shippingBaseTax = $this->_calculator->calcTaxAmount($baseCalcAmount, $rate);
}
$address->setTotalAmount('shipping', $shippingAmount);
$address->setBaseTotalAmount('shipping', $baseShippingAmount);
/**
* Provide additional attributes for apply discount on price include tax
*/
if ($this->_config->discountTax($store)) {
$address->setShippingAmountForDiscount($shippingAmount + $shippingTax);
$address->setBaseShippingAmountForDiscount($baseShippingAmount + $shippingBaseTax);
}
$this->_addAmount($shippingTax);
$this->_addBaseAmount($shippingBaseTax);
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
$this->_saveAppliedTaxes($address, $applied, $shippingTax, $shippingBaseTax, $rate);
}
}
$address->setShippingTaxAmount($shippingTax);
$address->setBaseShippingTaxAmount($shippingBaseTax);
return $this;
}
示例3: applyTaxAfterDiscount
/**
* Check what taxes should be applied after discount
*
* @param mixed $store
* @return bool
*/
public function applyTaxAfterDiscount($store = null)
{
return $this->_config->applyTaxAfterDiscount($store);
}