'customers'); if (isset($_GET['Create'])) $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers?schema=synopsis')); else $xml = $webService->get($opt); $resources = $xml->children()->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors echo 'Error : '.$e->getMessage().''; } if (count($_POST) > 0) { // Here we have XML before update, lets update XML foreach ($resources as $nodeKey => $node) { $resources->$nodeKey = $_POST[$nodeKey]; } try { $opt = array('resource' => 'customers'); if ($_GET['Create'] == 'Creating') { $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); echo "Successfully added."; } } catch (PrestaShopWebserviceException $ex) { // Here we are dealing with errors echo 'Error : '.$e->getMessage().''; } } // We set the Title echo '

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

'; // We set a link to go back to list if we are in creation if (isset($_GET['Create'])) echo 'Return to the list'; if (!isset($_GET['Create'])) echo ''; else echo '
'; echo ''; if (isset($resources)) { echo ''; if (count($_GET) == 0) { echo ''; foreach ($resources as $resource) { echo ''; } } else { echo ''; foreach ($resources as $key => $resource) { echo ''; } } } echo '
Id
'.$resource->attributes().'
'.$key; if ((bool)$resource['required'] == true) echo ' (*)'; // * for required fields echo ''; if (isset($_GET['Create'])) echo ''; echo '

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