[Skip to main content](#vessel-content)

#   Incorrect value stored in hikashop\_order

##

- **[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")**
- [![esotechie's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar7143.jpg)](/forum/user/7143-esotechie "View esotechie's Profile") Topic Author
- [ Offline](/forum/user/7143-esotechie)

Less More

- Posts: 180
- Thank you received: 13
-
-
-
- [](http://www.halare.co.uk/)
-

14 years 3 months ago [\#59852](#59852) by [esotechie](/forum/user/7143-esotechie "View esotechie's Profile")  *[Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#59852 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")* was created by *[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

14 years 3 months ago [\#59952](#59952) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#59952 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

We don't have the problem on our end.

Could you give more information on how to reproduce it ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")**
- [![esotechie's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar7143.jpg)](/forum/user/7143-esotechie "View esotechie's Profile") Topic Author
- [ Offline](/forum/user/7143-esotechie)

Less More

- Posts: 180
- Thank you received: 13
-
-
-
- [](http://www.halare.co.uk/)
-

14 years 3 months ago -  14 years 3 months ago [\#59966](#59966) by [esotechie](/forum/user/7143-esotechie "View esotechie's Profile")  Replied by *[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#59966 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

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: 14 years 3 months ago by [esotechie](/forum/user/7143-esotechie "View esotechie's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

14 years 3 months ago [\#60036](#60036) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#60036 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")**
- [![esotechie's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar7143.jpg)](/forum/user/7143-esotechie "View esotechie's Profile") Topic Author
- [ Offline](/forum/user/7143-esotechie)

Less More

- Posts: 180
- Thank you received: 13
-
-
-
- [](http://www.halare.co.uk/)
-

14 years 3 months ago [\#60054](#60054) by [esotechie](/forum/user/7143-esotechie "View esotechie's Profile")  Replied by *[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#60054 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

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

- [ ![ScreenShot2012-08-07at07.53.13.png](/forum/attachment/5093) ](/forum/attachment/5093 "...at07.53.13.png") [ ](/forum/attachment/5093?download=1 "...at07.53.13.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

14 years 3 months ago [\#60102](#60102) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#60102 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

Hello,

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

$discount_tax = $cart-&gt;coupon-&gt;total-&gt;prices[0]-&gt;price_value_with_tax-$cart-&gt;coupon-&gt;total-&gt;prices[0]-&gt;price_value;

by Code:

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")**
- [![esotechie's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar7143.jpg)](/forum/user/7143-esotechie "View esotechie's Profile") Topic Author
- [ Offline](/forum/user/7143-esotechie)

Less More

- Posts: 180
- Thank you received: 13
-
-
-
- [](http://www.halare.co.uk/)
-

14 years 3 months ago [\#60113](#60113) by [esotechie](/forum/user/7143-esotechie "View esotechie's Profile")  Replied by *[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#60113 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

14 years 3 months ago -  14 years 3 months ago [\#60155](#60155) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#60155 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

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

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

Then your **order\_discount\_tax** field will be corectly set.

Last edit: 14 years 3 months ago by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")**
- [![esotechie's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar7143.jpg)](/forum/user/7143-esotechie "View esotechie's Profile") Topic Author
- [ Offline](/forum/user/7143-esotechie)

Less More

- Posts: 180
- Thank you received: 13
-
-
-
- [](http://www.halare.co.uk/)
-

14 years 3 months ago [\#60254](#60254) by [esotechie](/forum/user/7143-esotechie "View esotechie's Profile")  Replied by *[esotechie](/forum/user/7143-esotechie "View esotechie's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#60254 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

- Add a tax to your coupon

Done already (if you mean selecting the Tax category)

- Go to "Hikashop-&gt;System-&gt;Configuration-&gt;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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

14 years 3 months ago [\#60352](#60352) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Incorrect value stored in hikashop\_order](/forum/3-bug-report/59852-incorrect-value-stored-in-hikashop-order#60352 "When a coupon is used, the figure for the total product tax is stored in the column order&#95;discount&#95;tax of table hikashop&#95;order, instead of the value of the tax on the discount amount.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81OTg1Mi1pbmNvcnJlY3QtdmFsdWUtc3RvcmVkLWluLWhpa2FzaG9wLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.089 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
