java2dev Posted November 3, 2016 Share Posted November 3, 2016 Hello, I can save order from marketplace using this function public function saveOrder($cart, $order_id) { $order = new Order(); $customer = new Customer($this->linio_user_id); $context = Context::getContext(); $order->product_list = $cart->getProducts(); $order->id_address_delivery = $this->address_id; $order->id_address_invoice = $this->address_id; $order->id_cart = $cart->id; $order->id_currency = $cart->id_currency; $order->id_customer = $cart->id_customer; $order->id_carrier = $cart->id_carrier; $order->payment = 'Pay '; $order->module = 'L-sync'; $order->conversion_rate = 1; $order->secure_key = $customer->secure_key; $order->current_state = _PS_OS_PREPARATION_; $order->reference = $order_id; $order->id_lang = $context->language->id; $order->id_shop = (int) $context->shop->id; $order->id_shop_group = (int) $context->shop->id_shop_group; $order->total_products = $order->total_products_wt = (float) $cart->getOrderTotal( false, Cart::ONLY_PRODUCTS, $order->product_list, $order->id_carrier ); $order->total_paid_real = 0; $order->total_paid_tax_excl = $order->total_paid_tax_incl = (float) Tools::ps_round( (float) $cart->getOrderTotal( false, Cart::BOTH, $order->product_list, $order->id_carrier ), 2 ); $order->total_paid = $order->total_paid_tax_incl; $order->invoice_date = '0000-00-00 00:00:00'; $order->delivery_date = '0000-00-00 00:00:00'; if ($order->add()) { $order_detail = new OrderDetail(); $order_detail->createList($order, $cart, $order->current_state, $order->product_list); $data = array( 'id_order' => $order->id, 'id_linio_order' => $this->id, ); Db::getInstance()->insert('liniosync_orders', $data); return true; } return false; } I saved important order attribute but it miss price , I've tried using this but it doesn't work $order->total_paid_tax_incl = (int) $xml->Body->Orders->Order->OrderId->Price; any idea how I could save the price value in total_paid_tax_incl, always the value saved is 0. Link to comment Share on other sites More sharing options...
java2dev Posted November 3, 2016 Author Share Posted November 3, 2016 any help? no one? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now