Created Date when saving order

  • Posts: 56
  • Thank you received: 1
10 months 3 weeks ago #352043

$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.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
10 months 3 weeks ago #352044

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.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum