agarmur Posted December 21, 2022 Share Posted December 21, 2022 (edited) Bonjour j'essaye d'ajouter une adresse à mon client, le client est bien créer mais il n'arrive pas à créer l'adresse Voici mon code : $crypto = new Hashing(); $xml = simplexml_load_file('php://input'); $client = new Customer($xml->id); $client->id_gender = 1; //1 monsieur 2 mademoiselle $client->firstname = (string)$xml->prenom; $client->lastname = (string)$xml->nom; $client->email = (string)$xml->email; $client->passwd = $crypto->hash($xml->motDePasse); $client->birthday = (string)$xml->dateAnniversaire; //aaaa-mm-jj $client->active = (bool)$xml->active; //true ou false $client->newsletter = (bool)$xml->newsletter; //true ou false $client->optin = (bool)$xml->offrePartenaire; //true ou false $client->id_default_group = 3; $client->add(); $address = new Address(); $address->firstname = $client->firstname; $address->lastname = $client->lastname; $address->id_customer = $client->id; $address->alias = "alias"; $address->company = "entreprise"; $address->address1 = "adresse1"; $address->address2 = "adresse2"; $address->postcode = "75000"; $address->city = "Paris"; $address->country = (int)Context::getContext()->country->id; $address->phone = "0000000000"; $address->phone_mobile = "0000000000"; $address->add(); $this->output .= $client->id; Merci ! Edited December 21, 2022 by agarmur résolution pb (see edit history) Link to comment Share on other sites More sharing options...
agarmur Posted December 21, 2022 Author Share Posted December 21, 2022 Update j'ai trouvé mon problème ! j'ai juste changé : $address->country = (int)Context::getContext()->country->id; Par: $address->id_country = (int)Context::getContext()->country->id; 1 Link to comment Share on other sites More sharing options...
Dev On Web Posted December 21, 2022 Share Posted December 21, 2022 Impeccable. J'ai supprimé le topic en doublon. 1 Link to comment Share on other sites More sharing options...
Mediacom87 Posted December 21, 2022 Share Posted December 21, 2022 Pensez à modifier le titre du Topic pour l'indiqué comme [Résolu] 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