-- HikaShop version -- : 4.0.1
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.2
-- Browser(s) name and version -- : Chrome latest
-- Error-message(debug-mod must be tuned on) -- : none
-- HikaShop version -- : 4.0.1
-- HikaMarket version -- : 3.0.0
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.2
-- Browser(s) name and version -- : Chrome latest
-- Error-message(debug-mod must be tuned on) -- : none
I've created a cronjob checking for EDI orders and creating them when one is there. The webshop has hikashop and hikamarket.
See also
www.hikashop.com/forum/23-market-how-to/...kmarket-vendors.html
It all works like a charm, but there is one annoying side-effect. When creating the order from the cart in this cronjob, the order is created but the cart is not emptied so it seems.
The code is as below:
$cart = new stdClass();
$cart->user_id = $user_id;
$cart->cart_shipping_address_ids = $shipping_address;
// Save an entry to DB to be able to get cart_id
$cartClass->save($cart);
$cart_id = $cartClass->getCurrentCartId('cart');
// Add all selected products at once
$cartClass->addProduct($cart_id, $product_data);
// Create basic order from cart
$orderClass = hikashop_get('class.order');
$order = $orderClass->createFromCart($cart_id);
// Retrieve current order to update for custom fields
$updateOrder = new stdClass();
$updateOrder = $orderClass->get($order->order_id);
// Update custom field date values
(...) // some extra code for custom fields and such
// Save order with custom field values
$orderClass->save($updateOrder);
I am sure I am doing something wrong, any idea how to debug?