I am working with a project in prestashop and in turn consuming information from the webservice, the problem I have is that I cannot access the data, I have my code like this:
public function getAllOrders()
{
$orderNumber = PrestashopOrder::all();
foreach($orderNumber as $number) {
try {
$webService = new PrestaShopWebservice('https://mitienda.com/', 'API_KEY', false);
// call to retrieve all customers
$xml = $webService->get([
'resource' => 'orders',
'id' => $number->order_number,
]);
$json = json_encode($xml);
$array = json_decode($json, true);
//dd($array);
$resourceRF = $array;
//dd($resourceRF);
foreach($array as $resource) {
//Aqui como acceso al valor ID
$resourceId = $resource["order"]['id'];
$neworder = PrestashopOrder::updateOrCreate(
['order_number' => $resourceId],
['order_number' => $resourceId,
'reference' => $resourceRF]
);
}
} catch (PrestaShopWebserviceException $ex) {
// Shows a message related to the error
echo 'Other error: <br />' . $ex->getMessage();
}
}
}
The doubt is how to access this data, I try this way but it always returns the complete array.
//Aqui como acceso al valor ID
$resourceId = $resource["order"]['id'];
the data is returning to me in this way