【发布时间】:2017-02-17 04:49:55
【问题描述】:
我需要限制税额。所以我去了Mage/Tax/Model/Calculation.php
然后找到 calcTaxAmount() 税收申请功能。 我需要限制税谁都在结帐时输入了税号,一页税应该为零
所以
public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true)
{
$billing = Mage::getModel('checkout/session')->getQuote()->getCustomerTaxvat();
if($billing != "" )
{
return 0;
}
$taxRate = $taxRate / 100;
if ($priceIncludeTax) {
$amount = $price * (1 - 1 / (1 + $taxRate));
} else {
$amount = $price * $taxRate;
}
if ($round) {
return $this->round($amount);
}
return $amount;
}
我添加了新条件。它在多家连锁店工作。只有一家商店无法正常工作。它导致用户无法注册,并且 addtocart 不适用于该特定商店。我发现 getQuote 的问题。我删除了如下所示的新条件,工作正常。
旧功能:-
public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true)
{
$taxRate = $taxRate / 100;
if ($priceIncludeTax) {
$amount = $price * (1 - 1 / (1 + $taxRate));
} else {
$amount = $price * $taxRate;
}
if ($round) {
return $this->round($amount);
}
return $amount;
}
【问题讨论】:
标签: php magento-1.9 checkout tax