Reputation: 489
I want to get products detail from order. I try it like:
$opt = array('resource' => 'orders', 'filter[id]' => '[' . $id_order . ']');
$xml = $webService->get($opt);
I know that product are inside order->associations->order_rows->order_row
But how to get this data? I can't get node associations.
Could somebody explain me it?
Upvotes: 1
Views: 1998
Reputation: 1573
When you are performing a query with a filter on the Prestashop Webservice it will return only the id attribute of all entities that matched that query. To avoid that you can add an additional parameter "display=full" that will force Prestashop to return all the informations for each entity found, that in this case means also the product list associated to an order.
Your request needs to become:
$opt = array('resource' => 'orders', 'filter[id]' => $id_order, 'display' => 'full');
$xml = $webService->get($opt);
As you can see i've also omitted the square bracket for the $id_order
parameter, if you're searching for a single order it's not needed.
Upvotes: 3