Error when I cancel the order from the back-end

  • Posts: 224
  • Thank you received: 26
  • Hikashop Business
4 weeks 2 days 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: 4 weeks 2 days ago by oxido. Reason: to add more details

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
4 weeks 2 days 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.056 seconds
Powered by Kunena Forum