avatarusswtor Posted November 7, 2015 Share Posted November 7, 2015 I have some problem with creating order via webservices is prestashop. I finaly manage to create order (client, addres and cars too), but there is something wrong with setting id_carrier. Despite what id_carrier i will set in order XML, order is created with default carrier (what is saved in preferences) Whats seems to be the problem? Here is code I use to create order: $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml = $webService->get(array('url' => PS_SHOP_PATH .'api/orders/?schema=synopsis')); $xml->order->id_address_delivery = $id_adresu; $xml->order->id_address_invoice = $id_adresu; $xml->order->id_cart = $id_koszyka; $xml->order->id_currency = 1; $xml->order->id_lang = 1; $xml->order->id_customer = $id_klienta; $xml->order->id_carrier = 25; //$xml->order->current_state = $current_state; //$xml->order->order_states = $current_state; $xml->order->module = $module; $xml->order->valid = 0; //$xml->order->id_shop_group = 1; //$xml->order->id_shop = 1; $xml->order->payment = $payment; $xml->order->total_discounts = 0; $xml->order->total_discounts_tax_incl = 0; $xml->order->total_discounts_tax_excl = 0; $xml->order->total_paid = $total_paid; $xml->order->total_paid_tax_incl = $total_paid_tax_incl; $xml->order->total_paid_tax_excl = 0; $xml->order->total_paid_real = $total_paid_real; $xml->order->total_products = $total_products; $xml->order->total_products_wt = $total_products_wt; $xml->order->total_shipping = $total_shipping; $xml->order->total_shipping_tax_incl = $total_shipping_tax_incl; $xml->order->total_shipping_tax_excl = 0; $xml->order->conversion_rate = 1; $opt = array('resource' => 'orders'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); and here is screen from my carriers in presta (with IDs) Link to comment Share on other sites More sharing options...
ExpressTech Posted November 7, 2015 Share Posted November 7, 2015 Is your id_carrier (25) compatible with the address you are providing? You should also checkout Prestashop classes folder to see how it behaves step by step. Link to comment Share on other sites More sharing options...
mccreadylemon Posted December 4, 2015 Share Posted December 4, 2015 I'm facing the same problem. My address is compatible. The id_carrier is written correctly in the cart but in the order is written the default. Any thoughts? Link to comment Share on other sites More sharing options...
jlb64 Posted March 15, 2018 Share Posted March 15, 2018 Hi, I have exactly the same problem, the id_carrier is written correctly in the cart but in the order is written the default, do you find the solution? Thanks 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