0dp Posted May 27, 2019 Share Posted May 27, 2019 (edited) Using the Prestashop webservice and PSWebServiceLibrary to create a new user registration I noticed that prestashop allows registration of users having the same email. // Create user in prestashop $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xmlResponse = $webService->get(array('url' => PS_SHOP_PATH.'/api/customers?schema=blank')); $customerXML = $xmlResponse->customer[0]; $customerXML->id_lang = $locale_id; $customerXML->lastname = $lastname; $customerXML->firstname = $firstname; $customerXML->email = $email; $customerXML->passwd = $password; $customerXML->id_gender = $gender; $customerXML->birtday = $birthday; $customerXML->active = '1'; $customerXML->associations->groups->group->id = GROUP_ID; try { $addedCustomerResponse = $webService->add([ 'resource' => 'customers', 'postXml' => $xmlResponse->asXML(), ]); $customerXML = $addedCustomerResponse->customer[0]; echo sprintf("Successfully create customer with ID: %s", (string) $customerXML->id); } catch (PrestaShopWebserviceException $e) { // if user exist, throw error that triggers frontend error echo json_encode(array( 'error' => array( 'msg' => $e->getMessage(), 'code' => $e->getCode(), ), )); } Firstly, I don't understand how and why this is even possible? Secondly, does Prestashops webservice allow for a way to check if the email is already in use? Edited May 27, 2019 by 0dp typo (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now