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

#   Error when I cancel the order from the back-end

##

- **[oxido](/forum/user/29793-oxido "View oxido's Profile")**
- [![oxido's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/29793-oxido "View oxido's Profile") Topic Author
- [ Offline](/forum/user/29793-oxido)

Less More

- Posts: 285
- Thank you received: 42
-
-

2 years 7 months ago -  2 years 7 months ago [\#360071](#360071) by [oxido](/forum/user/29793-oxido "View oxido's Profile")  *[Error when I cancel the order from the back-end](/forum/3-bug-report/907976-error-when-i-cancel-the-order-from-the-back-end#360071 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.2 -- PHP version -- : 8.1.27 -- Browser(s) name and version -- : Google chrome -- Error-message(debug-mod must be tuned on) -- : BIGINT UNSIGNED value is out of range in '&#96;my&#95;db&#96;.&#96;#&#95;&#95;hikashop&#95;discount&#96;.&#96;discount&#95;used&#95;times&#96; - 1'  Steps for reproduction. 1. Activate the affiliation. 2. Create a coupon code without limit of use and set &quot;Force affiliation to&quot;: (select 1 partner). 3. Create an order from Front-end and use the coupon. 4. In the back-end, go to Orders and change the status of the order to &quot;cancel&quot; It only happens when the status of the order is changed from anything to &quot;cancel&quot;  5. if the error does not appear on the first try, change the status by selecting any other option, then select &quot;cancelled&quot; again")* was created by *[oxido](/forum/user/29793-oxido "View oxido's Profile")*

-- HikaShop version -- : 5.0.3
-- Joomla version -- : 4.4.2
-- PHP version -- : 8.1.27
-- Browser(s) name and version -- : Google chrome
-- Error-message(debug-mod must be tuned on) -- : BIGINT UNSIGNED value is out of range in '&#96;my_db&#96;.&#96;#__hikashop_discount&#96;.&#96;discount_used_times&#96; - 1'

Steps for reproduction.
1. Activate the affiliation.
2. Create a coupon code without limit of use and set "Force affiliation to": (select 1 partner).
3. Create an order from Front-end and use the coupon.
4. In the back-end, go to Orders and change the status of the order to "cancel"
It only happens when the status of the order is changed from anything to "cancel"

**5. if the error does not appear on the first try, change the status by selecting any other option, then select "cancelled" again**
Code:

BIGINT UNSIGNED value is out of range in '&#96;my_db&#96;.&#96;#__hikashop_discount&#96;.&#96;discount_used_times&#96; - 1'

- [ ![hikashop&#95;error&#95;on&#95;canceling&#95;oxido.jpg](/forum/attachment/59053) ](/forum/attachment/59053 "...ling&#95;oxido.jpg") [ ](/forum/attachment/59053?download=1 "...ling&#95;oxido.jpg")

Last edit: 2 years 7 months ago by [oxido](/forum/user/29793-oxido "View oxido's Profile"). Reason: to add more details

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC85MDc5NzYtZXJyb3Itd2hlbi1pLWNhbmNlbC10aGUtb3JkZXItZnJvbS10aGUtYmFjay1lbmQ/dG1wbD1tYXJrZG93bg==) 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: 86564
- Thank you received: 14311
-
-

2 years 7 months ago [\#360076](#360076) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Error when I cancel the order from the back-end](/forum/3-bug-report/907976-error-when-i-cancel-the-order-from-the-back-end#360076 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.2 -- PHP version -- : 8.1.27 -- Browser(s) name and version -- : Google chrome -- Error-message(debug-mod must be tuned on) -- : BIGINT UNSIGNED value is out of range in '&#96;my&#95;db&#96;.&#96;#&#95;&#95;hikashop&#95;discount&#96;.&#96;discount&#95;used&#95;times&#96; - 1'  Steps for reproduction. 1. Activate the affiliation. 2. Create a coupon code without limit of use and set &quot;Force affiliation to&quot;: (select 1 partner). 3. Create an order from Front-end and use the coupon. 4. In the back-end, go to Orders and change the status of the order to &quot;cancel&quot; It only happens when the status of the order is changed from anything to &quot;cancel&quot;  5. if the error does not appear on the first try, change the status by selecting any other option, then select &quot;cancelled&quot; again")*

Hi,

Thank you for your feedback.
Change the line: Code:

$query = 'UPDATE '.hikashop_table('discount').' SET discount_used_times = discount_used_times - 1 WHERE discount_code='.$this-&gt;database-&gt;Quote($code).' AND discount_type=\'coupon\' LIMIT 1';

to: Code:

$query = 'UPDATE '.hikashop_table('discount').' SET discount_used_times = discount_used_times - 1 WHERE discount_used_times&gt; 0 AND discount_code='.$this-&gt;database-&gt;Quote($code).' AND discount_type=\'coupon\' LIMIT 1';

in the file administrator/components/com_hikashop/classes/order.php and it will fix the problem.
We'll add the fix on our end for the next version of HikaShop which is scheduled for the next few days.

The following user(s) said Thank You: [oxido](/forum/user/29793-oxido "View oxido's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC85MDc5NzYtZXJyb3Itd2hlbi1pLWNhbmNlbC10aGUtb3JkZXItZnJvbS10aGUtYmFjay1lbmQ/dG1wbD1tYXJrZG93bg==) 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.054 seconds

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