我正在使用 opencart 版本 2.3.0.2 ..
我在哪里获得所有价值,除非我优惠券价值税收价值出错并且显示价值也出错。
我希望在应用优惠券之前和应用优惠券价值后的单位折扣之前的每个产品单位税。
我在下面编写了一些代码,但无法通过单位折扣获得正确的值。通过使用下面的代码获取总折扣金额,我希望在应用优惠券价值时获得个人折扣税和折扣金额
$this->load->model('extension/total/coupon');
$coupon_info = $this->model_extension_total_coupon->getCoupon($this->session->data['coupon']);
if(isset($coupon_info) && !empty($coupon_info))
{
foreach($product as $taxpro) {
if($coupon_info['type'] == 'F')
{
$discount = $coupon_info['discount'] * ($taxpro['total'] / $sub_total);
} else
if ($coupon_info['type'] == 'P')
{
$discount = $taxpro['total'] / 100 * $coupon_info['discount'];
}
$tax_rates = $this->tax->getRates($taxpro['total'] - ($taxpro['total'] - $discount), $taxpro['tax_class_id']);
foreach ($tax_rates as $tax_rate)
{
echo "<pre>"; print_r($total_data['taxes'][$tax_rate['tax_rate_id']]);echo "<pre>";
if ($tax_rate['type'] == 'P')
{
$total_data['taxes'][$tax_rate['tax_rate_id']] -= $tax_rate['amount'];
}
echo "<pre>"; print_r($total_data['taxes'][$tax_rate['tax_rate_id']]);
}
foreach($tax_rates as $tax_coupon)
{
$protax = $tax_coupon['amount'];
$protax_unit = round($protax*$taxpro['quantity'],2);
$total_unit_tax += $protax_unit;
$coupon_tax += $tax_coupon['amount'];
}
}
}