[英]opencart taxes as discount
I am using opencart version 2.1.0.1. 我正在使用opencart版本2.1.0.1。
I want to set different tax values to products for different countries. 我想为不同国家/地区的产品设置不同的税值。 It's ok but when i want to give tax a negative value, it doesn't works. 可以,但是当我想给税负值时,它是行不通的。
Is this possible to use negative value on taxes by changing the code? 通过更改代码是否有可能对税收使用负值? I want to apply some discounts by tax. 我想通过税收申请一些折扣。 Please help. 请帮忙。
Tax.php like this: Tax.php像这样:
<?php
class ModelTotalTax extends Model {
public function getTotal(&$total_data, &$total, &$taxes) {
foreach ($taxes as $key => $value) {
if ($value > 0) {
$total_data[] = array(
'code' => 'tax',
'title' => $this->tax->getRateName($key),
'value' => $value,
'sort_order' => $this->config->get('tax_sort_order')
);
$total += $value;
}
}
}
}
What's the error when you add - values from the admin panel? 添加时出现什么错误-管理面板中的值?
You can also duplicate the tax module (don't forget to change class ModelTotalTax
to something else in your new module, like class ModelTotalDuplicated
) and edit the code, specifically this line you'd want to change (in your duplicated module): 您还可以复制tax模块(不要忘记将class ModelTotalTax
为新模块中的其他东西,例如class ModelTotalDuplicated
)并编辑代码,尤其是要更改的行(在复制的模块中):
$total += $value;
to 至
$total -= $value;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.