I would like to retrieve customer data in a list of orders that I have. Ando something lost in how to recover the detail of each element that forms the XML from the xlink ...
The current structure that I have in the XML that returns to me is:
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<orders>
<order>
<id><![CDATA[1]]></id>
<id_address_delivery xlink:href="https://direccionweb.com/api/addresses/1"><![CDATA[1]]></id_address_delivery>
<id_cart xlink:href="https://direccionweb.com/api/carts/1"><![CDATA[1]]></id_cart>
<id_customer xlink:href="https://direccionweb.com/api/customers/1"><![CDATA[1]]></id_customer>
<id_carrier xlink:href="https://direccionweb.com/api/carriers/1"><![CDATA[1]]></id_carrier>
<current_state xlink:href="https://direccionweb.com/api/order_states/1"><![CDATA[1]]></current_state>
</order>
<order>
<id><![CDATA[2]]></id>
<id_address_delivery xlink:href="https://direccionweb.com/api/addresses/2"><![CDATA[2]]></id_address_delivery>
<id_cart xlink:href="https://direccionweb.com/api/carts/2"><![CDATA[2]]></id_cart>
<id_customer xlink:href="https://direccionweb.com/api/customers/2"><![CDATA[2]]></id_customer>
<id_carrier xlink:href="https://direccionweb.com/api/carriers/1"><![CDATA[1]]></id_carrier>
<current_state xlink:href="https://direccionweb.com/api/order_states/1"><![CDATA[1]]></current_state>
</order>
</orders>
</prestashop>
And what I want is, among other things, to show the client's data (name, surnames and others).
I know that the client 1 data will be at: link That of the client 2 : link
and so on. But how do I do it to have all the data together? Should I make multiple calls? How exactly?
Currently, I get to paint the client's id. So like this:
try {
// creating web service access
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
// call to retrieve all customers
$xml = $webService->get(array(
'resource' => 'orders',
'display' => '[id, id_address_delivery, id_cart, id_carrier, id_customer, current_state]'
));
$resources = $xml->orders->order;
foreach($resources as $resource)
echo '<label>Pedido</label><p>' . $resource->children()->id . '</p>' .
'<label>Cliente<label><p>' . $resource->children()->id_customer . '</p>';
}
catch (PrestaShopWebserviceException $ex) {
// Shows a message related to the error
echo 'Other error: <br />' . $ex->getMessage();
}