Lomse Lomse - 3 months ago 85
PHP Question

Prestashop webservice PSWebServiceLibrary retured empty order details

To get a particular shop orders, I am using PSWebServiceLibrary.php from LINK on prestashop 1.6.

This is my code

require_once 'PSWebServiceLibrary.php';
$opt['id'] = 1; // Looking for details for order 1
$opt['resource'] = 'orders';

// Call
$webService = new PrestaShopWebservice('http://myprestashop_shop_url.com', '*****', true);
$xml = $webService->get($opt);

$resources = $xml->children()->children();

echo '<pre>';
print_r($resources);
echo '</pre>';


RETURN HTTP BODY has returned all the values I am looking for as shown on pic1.


pic1

But $resources returned empty values as shown on pic2. pic2

Can someone please tell me what I am missing? Thanks

NOTE: In the Advance Parameters/Webservice I have enabled all including order_details and order_histories. Can someone please help?

Answer

$resources is not empty, it contains SimpleXMLElement Objects. Try echo $resources->id.