Error when I cancel the order from the back-end

  • Posts: 231
  • Thank you received: 28
  • Hikashop Business
8 months 3 weeks ago #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 '`my_db`.`#__hikashop_discount`.`discount_used_times` - 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

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

Attachments:
Last edit: 8 months 3 weeks ago by oxido. Reason: to add more details

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
8 months 3 weeks ago #360076

Hi,

Thank you for your feedback.
Change the line:

$query = 'UPDATE '.hikashop_table('discount').' SET discount_used_times = discount_used_times - 1 WHERE discount_code='.$this->database->Quote($code).' AND discount_type=\'coupon\' LIMIT 1';
to:
$query = 'UPDATE '.hikashop_table('discount').' SET discount_used_times = discount_used_times - 1 WHERE discount_used_times> 0 AND discount_code='.$this->database->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

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

Time to create page: 0.059 seconds
Powered by Kunena Forum