Jump to content

Prestashop 1.7.3 webservice - creating a new order -> 500 Error


Barama

Recommended Posts

I also posted this on stackoverflow (https://stackoverflow.com/questions/49085954/prestashop-1-7-3-webservice-creating-a-new-order-500-error)

 

Clients, Adresses and Carts imports works fine but when trying to insert new Order, it returns this error:

This call to PrestaShop Web Services failed and returned an HTTP status of 500. That means: Internal Server Error.

I am using PSWebServiceLibrary.php and I have debug modus turned on. But the error message is way too generic for me.

I have searched stackoverflow and the prestashop forums. Others have the same problem (for example: Prestashop 1.6 Webservice Order).

But it seems nobody knows what's wrong.

 

 public function add_order(array $order, array $products)
    {                                    
        $xml = $this->webService->get(array('url' => $this->shop_path . '/api/orders?schema=blank'));
        
        $xml->order->id_customer = 198;
        $xml->order->id_address_delivery = 493;
        $xml->order->id_address_invoice = 492;
        $xml->order->id_cart = 220;  
        $xml->order->id_currency = 1;
        $xml->order->id_lang = 1;
        $xml->order->id_carrier = 1;
        $xml->order->current_state = 14;
        $xml->order->valid = 0;
        $xml->order->payment = 'Bankwire';
        $xml->order->module = 'bankwire';
        $xml->order->total_paid = 33.850000;
        $xml->order->total_paid_tax_incl = 33.850000;
        $xml->order->total_paid_tax_excl = 28.445390;
        $xml->order->total_paid_real = 33.850000;
        $xml->order->total_products = 25.126060;
        $xml->order->total_products_wt = 29.900000;
        $xml->order->total_shipping = 3.950000;
        $xml->order->total_shipping_tax_incl = 3.950000;
        $xml->order->total_shipping_tax_excl = 3.319330;
        $xml->order->carrier_tax_rate = 19.000;
        $xml->order->round_mode = 2;
        $xml->order->reference = "ASKLDFJALSKD";
        $xml->order->conversion_rate = 1.000000;
        
        $xml->order->associations->order_rows->order_row->product_id = 0;
        $xml->order->associations->order_rows->order_row->product_attribute_id = 0;
        $xml->order->associations->order_rows->order_row->product_quantity = 2;
        $xml->order->associations->order_rows->order_row->product_name = "10x Collieretui";
        $xml->order->associations->order_rows->order_row->product_reference = "702360";
        $xml->order->associations->order_rows->order_row->product_price = 12.563030;
        $xml->order->associations->order_rows->order_row->product_price_tax_incl = 14.950000;
        $xml->order->associations->order_rows->order_row->product_price_tax_excl = 12.563030;

        $opt = array('resource' => 'orders');
        $opt['postXml'] = $xml->asXML();
        $xml = $this->webService->add($opt);
    }

 

 

 

 

 

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...