modifyOrder method not updating order's status !

  • Posts: 4
  • Thank you received: 0
6 years 9 months ago #272088

-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.2
-- PHP version -- : 7.0.19

Hello,

First of all thanks to the developers for great e-commerce extension. I am working for a payment plugin & have taken alipay as sample of my work. The plugin is working fine but after getting notification from payment server I tried to use modifyOrder() method to update the order status but it's not working.

I am doing like:

$history = new stdClass();
$price_check = round($dbOrder->order_full_price, (int)$this->currency->currency_locale['int_frac_digits'] );

$history->notified=1;
$history->amount=$price_check;
$history->data = ob_get_clean();
$order_status = $this->payment_params->verified_status;
if($dbOrder->order_status == $order_status) return true;
$this->modifyOrder($order_id,$order_status,$history,false);

But the above code not updating the order's status. I checked that $order_id is OK, $this->payment_params & $this->getOrder($order_id) has the data too. I tried to do update the status of the order manually like this:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$fields = array($db->quoteName('order_status') . ' = ' . $db->quote($order_status));
$conditions = array($db->quoteName('order_id') . ' = ' . $db->quote($order_id));
$query->update($db->quoteName('#__hikashop_order'))->set($fields)->where($conditions);
$db->setQuery($query);
$result = $db->execute();

But I can't understand why modifyOrder() method not working. I can change the status manually but it won't send confirmation emails & will avoid running other important triggers. Any suggestion please?

Thanks

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

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
6 years 9 months ago #272131

Hello,

Depending the context, modifyOrder should receive the order ID or the order object.
By giving the order ID, the database is updated ; but if just after that, the order is modified by the HikaShop core ; for sure your modification will be overwrite.

Regards,

PS : Replying to your own message won't make our answer faster but it will have in fact the total opposite effect.
We reply to messages in order and we generally reply under 24 hours ; but we need to sleep and take some rest during the week end. Thank you for your understading.


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum