...
- The store's root path (ex:
http://
myprestashopexample.com/
). - The authentication key (ex: ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT).
- A boolean value, indicating whether the Web service must use its debug mode.
...
Code Block |
---|
$webService = new PrestaShopWebservice('http://myprestashopexample.com/', 'ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT', false); |
...
- In the
try
block, we instantiate thePrestaShopWebservice
object with the necessary parameters and retrieve thecustomer
resource XML in a variable. - In the
catch
block, we put code to display the PHP error message, if anything wrong happens in thetry
block.
Code Block |
---|
try { // creating web service access $webService = new PrestaShopWebservice('http://maboutiqueexample.com/', 'ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT', false); // call to retrieve all clients $xml = $webService->get(array('resource' => 'customers')); } catch (PrestaShopWebserviceException $ex) { // Shows a message related to the error echo 'Other error: <br />' . $ex->getMessage(); } |
...
Launching the code above will return a *impleXML
SimpleXML
object containing all the client IDs.
...
Thanks to these elements, we can create a HTML table containing all the client IDs. Try that before reading the next chapter.
You can use the "CcustomersCustomers" menu in the back-office to find the IDs of all customers. If you encounter difficulties, have a look at the example file named 0-CustomersList.php
, to see the results you should get.