Incorrect value stored in hikashop_order

  • Posts: 180
  • Thank you received: 13
11 years 8 months ago #59852

When a coupon is used, the figure for the total product tax is stored in the column order_discount_tax of table hikashop_order, instead of the value of the tax on the discount amount.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
11 years 8 months ago #59952

We don't have the problem on our end.

Could you give more information on how to reproduce it ?

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 13
11 years 8 months ago #59966

Thanks for the reply Nicolas,

Two different orders created:
Order 1:
Coupon 5.00, with no rules.
2 Products, one for 150.00+30.00Tax, one for 24.00+4.80Tax.
Shipping 8.40
The value in order_discount_tax = 34.80000
I believe it should be 0.83333

Order 1:
Coupon 6.00, with no rules.
1 Product, for 23.33+4.67Tax
Shipping 7.20
The value in order_discount_tax = 4.67000
I believe it should be 1.00000

Tax is as for UK at 20%

The orders show with correct values at the backend, so the column may not be used there. I was looking at the data in MySQL so that I can access it from another source and saw this as a discrepancy. I have got around this by doing calculations, but thought you may need to know about it.

Let me know if you need more information.

Last edit: 11 years 8 months ago by esotechie.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
11 years 8 months ago #60036

Could you do a screenshot of the coupon's options and tell us the value of the "apply discounts" option of the main tab of the configuration ? That would help us reproduce the problem.

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 13
11 years 8 months ago #60054

The setting for Apply Discounts in configuration is "After taxes".

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #60102

Hello,

I managed to solve this problem by editing the file "..\components\com_hikashop\controllers\checkout.php", I replaced the line :

$discount_tax = $cart->coupon->total->prices[0]->price_value_with_tax-$cart->coupon->total->prices[0]->price_value;
by
$discount_tax = (@$cart->coupon->total->prices[0]->price_value_without_discount_with_tax-@$cart->coupon->total->prices[0]->price_value_without_discount)-(@$cart->coupon->total->prices[0]->price_value_with_tax-@$cart->coupon->total->prices[0]->price_value);

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 13
11 years 8 months ago #60113

Thanks Mohamed.

I tried the change you suggested, and I am afraid it is still incorrect.

Now the value is zero. So it is not calculating and putting the VAT on tax in the column. I tried with a coupon at value of 6.00 with tax at 20%. The value in order_discount_tax is zero and in order_discount_price 6.00000 as expected.

I do not know if this applies, but if the process is similar, have a look at the calculation for shipping tax as that is working out correctly.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #60155

I think that it's working properly, because for example you can :

- Add a tax to your coupon
- Go to "Hikashop->System->Configuration->main"
- Set the "Apply discounts" option to Before taxes

Then your order_discount_tax field will be corectly set.

Last edit: 11 years 8 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 13
11 years 8 months ago #60254

- Add a tax to your coupon

Done already (if you mean selecting the Tax category)

- Go to "Hikashop->System->Configuration->main"
- Set the "Apply discounts" option to Before taxes

Why? That does nor make sense to me. You want the calculation after tax is applied to the products, but you want to see what was taken off the product price and what was reduced on the VAT.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
11 years 8 months ago #60352

The option works the other way around.

When the coupon is applied before the taxes, the coupon is added to the product before taxes have been applied.
Then, taxes are applied to the products AND to the coupon.

If the coupon is applied after the taxes, the coupon value won't be taxed as the taxes calculations have already been done.

Please Log in or Create an account to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum