Customers Deletion
'; // We set a link to go back to list echo 'Return to the list'; try { $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); // Call for a deletion, we specify the resource name and the id of the resource in order to delete the item $webService->delete(array('resource' => 'customers', 'id' => intval($_GET['DeleteID']))); // If there's an error we throw an exception echo 'Successfully deleted !'; } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error'; } } else { // Else get customers list try { $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $opt = array('resource' => 'customers'); $xml = $webService->get($opt); $resources = $xml->children()->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error'; } echo '

Customers List

'; echo ''; if (isset($resources)) { echo ''; if (!isset($DeletionID)) { echo ''; foreach ($resources as $resource) { echo ''; } } echo '
IdMore
'.$resource->attributes().''. 'Delete'. '

'; } } ?>