Prestashop 1.6 Webservice Order


I'm trying to finish my custom module to import clients, addresses, carts and orders from a webservice.

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.

If i take a look to my apache2 error.log I can see this error:

PHP Fatal error: Call to a member function validateOrder() on boolean in /var/www/html/prestashop_pool/myshop/classes/order/Order.php on line 1463

This piece of code is the ones related to the order adittion via WebService:

// Getting the structure of an order $xml = $webService->get(array('url' => PS_SHOP_PATH .'api/orders/?schema=blank')); // Adding dinamic and required fields // Required $xml->order->id_address_delivery = $id_address; // Customer address $xml->order->id_address_invoice = $id_address; $xml->order->id_cart = $id_cart; $xml->order->id_currency = $id_currency; $xml->order->id_lang = $id_lang; $xml->order->id_customer = $id_customer; $xml->order->id_carrier = $id_carrier; $xml->order->module = $order_module; $xml->order->payment = $order_payment; $xml->order->total_paid = $total_paid; $xml->order->total_paid_real = $total_paid_real; $xml->order->total_products = $total_products; $xml->order->total_products_wt = $total_products_wt; $xml->order->conversion_rate = 1; // Others $xml->order->valid = 1; $xml->order->current_state = $id_status; $xml->order->total_discounts = $total_discounts; $xml->order->total_discounts_tax_incl = $total_discounts_tax_incl; $xml->order->total_discounts_tax_excl = $total_discounts_tax_excl; $xml->order->total_paid_tax_incl = $total_paid_tax_incl; $xml->order->total_paid_tax_excl = $total_paid_tax_excl; $xml->order->total_shipping = $total_shipping; $xml->order->total_shipping_tax_incl = $total_shipping_tax_incl; $xml->order->total_shipping_tax_excl = $total_shipping_tax_excl; // Order Row. Required $xml->order->associations->order_rows->order_row[0]->product_id = $products[0]['id_product']; $xml->order->associations->order_rows->order_row[0]->product_attribute_id = $products[0]['id_product_attribute']; $xml->order->associations->order_rows->order_row[0]->product_quantity = $products[0]['quantity']; // Order Row. Others $xml->order->associations->order_rows->order_row[0]->product_name = $products[0]['name']; $xml->order->associations->order_rows->order_row[0]->product_reference = $products[0]['reference']; $xml->order->associations->order_rows->order_row[0]->product_price = $products[0]['product_price']; $xml->order->associations->order_rows->order_row[0]->unit_price_tax_incl = $products[0]['product_price']; $xml->order->associations->order_rows->order_row[0]->unit_price_tax_excl = $products[0]['product_price']; // Creating the order $opt = array( 'resource' => 'orders' ); $opt['postXml'] = $xml->asXML(); $xml = $webService->add( $opt ); $id_order = $xml->order->id

Anyone knows how to fix it?


It may be due to the wrong values you are passing in

$xml->order->module = $order_module; $xml->order->payment = $order_payment;

check this value, I think prestashop need ps_ prefix before adding module value.


  • add my css to theme in prestashop
  • JSONPath Syntax when dot in key
  • Reflection / C# typing errors when publishing an F# class implementing an interface
  • SQL - count occurrences of gender
  • How to get a list with description of all dba packages
  • Reassigning an array frees the memory used by it?
  • hibernate sets dirty flag (and issues update) even though client did not change value
  • C++ friend class std::vector
  • SetWindowsHookEx does not react on media keys
  • Why use database factory in asp.net mvc?
  • Can someone please explain to me in the most layman terms how to use EventArgs?
  • Breeze - Deleted Items nav properties bug
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Using $this when not in object context
  • Optimizing database types to compact database (SQLite)
  • How do I fake an specific browser client when using Java's Net library?
  • javaw.exe and eclipse startup problems
  • How reduce the height of an mschart by breaking up the y-axis
  • output of program is not same as passed argument
  • Cross-Platform Protobuf Serialization
  • Perl system calls when running as another user using sudo
  • Statically linking a C++ library to a C# process using CLI or any other way
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • How to get icons for entities from eclipse?
  • A cron job substitute?
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • python regex in pyparsing
  • Trying to get generic when generic is not available
  • Change div Background jquery
  • need help with bizarre java.net.HttpURLConnection behavior
  • Turn off referential integrity in Derby? is it possible?
  • How does Linux kernel interrupt the application?
  • JaxB to read class hierarchy
  • Busy indicator not showing up in wpf window [duplicate]
  • Why do underscore prefixed variables exist?