'customers'); if (isset($_GET['id'])) $opt['id'] = $_GET['id']; $xml = $webService->get($opt); // Here we get the elements from children of customer markup which is children of prestashop root markup $resources = $xml->children()->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors echo 'Error : '.$e->getMessage().''; } // Second : We update the data and send it to the web service if (isset($_GET['id']) && isset($_POST['id'])) // Here we check id cause in every resource there's an id { // Here we have XML before update, lets update XML with new values foreach ($resources as $nodeKey => $node) { $resources->$nodeKey = $_POST[$nodeKey]; } // And call the web service try { $opt = array('resource' => 'customers'); $opt['putXml'] = $xml->asXML(); $opt['id'] = $_GET['id']; $xml = $webService->edit($opt); // if WebService don't throw an exception the action worked well and we don't show the following message echo "Successfully updated."; } catch (PrestaShopWebserviceException $ex) { // Here we are dealing with errors echo 'Error : '.$e->getMessage().''; } } // UI // We set the Title echo '

Customer\'s '; if (isset($_GET['id'])) echo 'Update'; else echo 'List'; echo '

'; // We set a link to go back to list if we are in customer's details if (isset($_GET['id'])) echo 'Return to the list'; if (isset($_GET['id'])) echo '
'; echo ''; if (isset($resources)) { echo ''; if (!isset($_GET['id'])) { //Show list of customers echo ''; foreach ($resources as $resource) { echo ''; } } else { //Show customer form echo ''; foreach ($resources as $key => $resource) { echo ''; } } } echo '
IdMore
'.$resource->attributes().''. 'Update '. '
'.$key.''; echo ''; echo '

'; if (isset($_GET['id'])) echo '
'; ?>