【发布时间】:2011-07-04 07:17:32
【问题描述】:
我已将 Magento 设置为在结帐时不显示增值税,但它仍在总计中添加。它不会把它加到总数中——这是正确的。
例如,如果我有一件商品的价格为 5 英镑 - 含 20% 的增值税,它是 6 英镑,并且设置为在目录价格中显示 - 它确实如此。现在结帐时,该商品将显示为 6 英镑,然后是 1 英镑增值税,然后显示总额,即 6 英镑..?有没有其他人看过这个?
【问题讨论】:
我已将 Magento 设置为在结帐时不显示增值税,但它仍在总计中添加。它不会把它加到总数中——这是正确的。
例如,如果我有一件商品的价格为 5 英镑 - 含 20% 的增值税,它是 6 英镑,并且设置为在目录价格中显示 - 它确实如此。现在结帐时,该商品将显示为 6 英镑,然后是 1 英镑增值税,然后显示总额,即 6 英镑..?有没有其他人看过这个?
【问题讨论】:
要在文件末尾的 /app/code/local/Mage/Sales/Model/Quote/Address/Total/Tax.php 中隐藏税务注释:
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$applied = $address->getAppliedTaxes();
$store = $address->getQuote()->getStore();
$amount = $address->getTaxAmount();
/* if (($amount!=0) || (Mage::helper('tax')->displayZeroTax($store))) {
$address->addTotal(array(
'code'=>$this->getCode(),
'title'=>Mage::helper('sales')->__('Tax'),
'full_info'=>$applied ? $applied : array(),
'value'=>$amount
));
} */
return $this;
}
要在运费中包含税金,请在文件末尾的 /app/code/local/Mage/Sales/Model/Quote/Address/Total/Subtotal.php 中进行更改
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$amount = $address->getShippingAmount();
if ($amount!=0 || $address->getShippingDescription()) {
$address->addTotal(array(
'code'=>$this->getCode(),
'title'=>Mage::helper('sales')->__('Shipping & Handling').' ('.$address->getShippingDescription().')',
// OLD 'value'=>$address->getShippingAmount()
'value'=>number_format($address->getShippingAmount() + $address->getShippingTaxAmount(), 2)
));
}
return $this;
}
要在小计中包含税款,请更改文件末尾的 /app/code/local/Mage/Sales/Model/Quote/Address/Total/Subtotal.php:
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$address->addTotal(array(
'code'=>$this->getCode(),
'title'=>Mage::helper('sales')->__('Subtotal'),
// OLD 'value'=>$address->getSubtotal()
'value'=>number_format($address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount(), 2)
));
return $this;
}
【讨论】:
在您的配置屏幕截图中,我看到“购物车显示设置”中的价格设置为显示含税价格。如果我理解正确,我认为您应该将其设置为“不含税”(针对价格和小计)。
【讨论】:
最后,我解决此问题的唯一方法是从 magento 中删除税款,并选中显示我们提交的价格包含税款的框。不理想。
【讨论】:
我刚刚在 Magento 1.6.2 上遇到了同样的问题 - 我知道 OP 不再需要答案,但它可能会在适当的时候帮助其他人。
假设您只想更改输出,而不是调整任何计算,那么我们可以查看在模板文件 (.phtml) 中调整输出。
这有一个简单的优点,它不会影响任何其他可能使用该功能的东西。
打开模板提示,并访问购物车查看输出,我们看到正在使用的模板是:
frontend/base/default/template/tax/checkout/tax.phtml
和
frontend/base/default/template/tax/checkout/subtotal.phtml
作为基础,我们将在进行任何更改之前将这些副本复制到本地(我假设默认/默认) - 所以创建前端/默认/默认/模板/税/结帐/tax.phtml & 前端/default/default/template/tax/checkout/subtotal.phtml 内容相同。
然后在文件中进行以下编辑 - 在这两种情况下都注释掉当前产生输出的行(如果你的设置与我的不同,只需跟踪逻辑)。
frontend/default/default/template/tax/checkout/tax.phtml(第 46 到 55 行)
<!--<tr <?php if ($this->helper('tax')->displayFullSummary() && $_value!=0): ?> class="summary-total" onclick="expandDetails(this, '.summary-details-<?php echo $taxIter;?>')"<?php endif; ?>>
<td style="<?php echo $_style . 'display:none;' ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
<?php if ($this->helper('tax')->displayFullSummary()): ?>
<div class="summary-collapse"><?php echo $this->getTotal()->getTitle() ?></div>
<?php else: ?>
<?php echo $this->getTotal()->getTitle() ?>
<?php endif;?>
</td>
<td style="<?php echo $_style . 'display:none;' ?>" class="a-right"><?php echo $this->helper('checkout')->formatPrice($_value) ?></td>
-->
frontend/default/default/template/tax/checkout/subtotal.phtml(行:48 到 57)
<?php else : ?>
<!--<tr>
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
<?php echo $this->getTotal()->getTitle() ?>
</td>
<td style="<?php echo $this->getStyle() ?>" class="a-right">
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
</td>
</tr>-->
<?php endif;?>
一开始可能存在底层设置或逻辑问题导致此输出,但是此方法会抑制您不想要的输出。
【讨论】: