- Posts: 56
- Thank you received: 1
Created Date when saving order
3 years 5 months ago #352043
by jiawen
Created Date when saving order was created by jiawen
$orderClass = hikashop_get('class.order');
$orderClass->save($order);
using this to manually save a hikashop order. it works fine when saving the fields excepting the created date.
$order->order_created = $timestamp;
using this to save the timestamp that order created, but always the current time be saved for the order.
$orderClass->save($order);
using this to manually save a hikashop order. it works fine when saving the fields excepting the created date.
$order->order_created = $timestamp;
using this to save the timestamp that order created, but always the current time be saved for the order.
Please Log in or Create an account to join the conversation.
3 years 5 months ago #352044
by nicolas
Replied by nicolas on topic Created Date when saving order
Hi,
That's normal. The order_created is set by HikaShop inside the save function for new orders, regardless of what you provide.
What you can do is to resave the order with the order_created after the first save.
Otherwise, you can also implement the "onBeforeOrderCreate" event and set the order_created in there. The event happens after the save function sets the order_created with the current date, but before the order data is saved in the database. So it's a nice and lightweight method to force the order_created value to whatever you want.
That's normal. The order_created is set by HikaShop inside the save function for new orders, regardless of what you provide.
What you can do is to resave the order with the order_created after the first save.
Otherwise, you can also implement the "onBeforeOrderCreate" event and set the order_created in there. The event happens after the save function sets the order_created with the current date, but before the order data is saved in the database. So it's a nice and lightweight method to force the order_created value to whatever you want.
Please Log in or Create an account to join the conversation.
Time to create page: 0.044 seconds