Skip to main content

How to change order status from PHP?

More
9 years 6 months ago #264173 by danidek
Hi,

I have to integrate a bank transfer payment app. It handles all invoicing and payment according to local law, what is not easy other way.
When all finished, it calls a php on my site where I want to change the order status to "confirmed" from php.
I know the order ID, but I did not find and doc what functions can I call to change the status of order.
I need to trigger the user notification email as well.

Thank you for your help!

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

More
9 years 6 months ago #264176 by Jerome
Hi,
Code:
$order = new stdClass(); $order->order_id = $order_id; // Information needed $order->order_status = 'confirmed'; $hikashopHelper = rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_hikashop'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php'; if(file_exists($hikashopHelper) && include_once($hikashopHelper)) { $orderClass = hikashop_get('class.order'); $orderClass->save($order); }

Regards,

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.
The following user(s) said Thank You: danidek

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

More
9 years 6 months ago #264247 by danidek
Thank you!. I've added a joomla login script before to get authenticated and it changes the status well. I've used Virtuemart before, but with Hikashop it takes 20 minutes what I did in Virtuemart in 2 days...

Can you help me in the notification of the user as well? The email was not sent.
The following user(s) said Thank You: Jerome

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

More
9 years 6 months ago #264297 by nicolas
Hi,

You can add such line before the save:
Code:
$order->history->history_notified = 1;

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

More
9 years 2 months ago #274735 by ler@singmuiheng.com
What about to set the remark beside the status changed message?

Is it $order->history->mymessage ?

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

More
9 years 1 month ago #274801 by ler@singmuiheng.com
We noticed one thg when using $orderClass->save($order);

the invoice number was not generated.....did we miss out something?

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

More
9 years 1 month ago - 9 years 1 month ago #274739 by Jerome
Hello
Code:
$order->history->history_data
Don't hesitate to take a look at the HikaShop code and plugins code in order to see how they are dealing with order status modification.
You can find for example a lot of useful code in the HikaShop helper core file ; in the hikashopPaymentPlugin class definition.

The invoice number is only generated by the save function when the status of the order changes from the created order status to one of the invoice order statuses as you can configure in the menu System>Order statuses. So you might actually have an issue with your order statuses, or you didn't set an invoice status in the order_status attribute of your $order object.

Regards,

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.
Last edit: 9 years 1 month ago by nicolas.

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

More
9 years 1 month ago #275010 by ler@singmuiheng.com
Dear Jerome

We are unable to find "invoice order statuses as you can configure in the menu System>Order statuses" since version 3.1.1 , can you advise?

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

More
9 years 1 month ago #275025 by Jerome
Hello,

I'm sorry but I cannot ; There is the "invoice" column in the order statuses listing so I don't understand your message.

Regards,

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.

More
9 years 1 month ago #276803 by ler@singmuiheng.com

Jerome wrote: Hello

Code:
$order->history->history_data
Don't hesitate to take a look at the HikaShop code and plugins code in order to see how they are dealing with order status modification.
You can find for example a lot of useful code in the HikaShop helper core file ; in the hikashopPaymentPlugin class definition.

The invoice number is only generated by the save function when the status of the order changes from the created order status to one of the invoice order statuses as you can configure in the menu System>Order statuses. So you might actually have an issue with your order statuses, or you didn't set an invoice status in the order_status attribute of your $order object.

Regards,


we are unable to find as you mentioned since version 3.1

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

More
9 years 1 month ago #276821 by nicolas
Hi,

Kind you provide a screenshot of what you're looking at ?

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

Time to create page: 0.246 seconds
Powered by Kunena Forum