jean-seb62 Posted December 28, 2020 Posted December 28, 2020 Bonjour, je voudrais savoir si c'est possible de personnaliser le formulaire de création d'un compte en ajoutant une adresse complète (voir l'image ci-dessous )? Share this post Link to post Share on other sites More sharing options...
Eolia Posted December 28, 2020 Posted December 28, 2020 Dans les préférences sélectionnez "Création de compte et d'adresse" au lieu de "création de compte seulement" Share this post Link to post Share on other sites More sharing options...
jean-seb62 Posted December 29, 2020 Posted December 29, 2020 Je suis sur la version 1.7, je n'ai pas le menu "Préférences" 😠 Share this post Link to post Share on other sites More sharing options...
Eolia Posted December 29, 2020 Posted December 29, 2020 cherchez un peu dans les paramètres de la boutique ce qui concerne les clients Share this post Link to post Share on other sites More sharing options...
Mediacom87 Posted December 29, 2020 Posted December 29, 2020 Il y a 17 heures, Eolia a dit : Dans les préférences sélectionnez "Création de compte et d'adresse" au lieu de "création de compte seulement" Cela n'existe plus du tout en 1.7 😄 Share this post Link to post Share on other sites More sharing options...
Eolia Posted December 29, 2020 Posted December 29, 2020 Et encore une fonctionnalité en moins...Super^^ Share this post Link to post Share on other sites More sharing options...
Mediacom87 Posted December 29, 2020 Posted December 29, 2020 à l’instant, Eolia a dit : Et encore une fonctionnalité en moins...Super^^ peut être est elle cachée dans la 3ème section du 2ème onglet du 3ème sous menu d'un truc que je n'ai pas trouvé 🙂 Share this post Link to post Share on other sites More sharing options...
jean-seb62 Posted December 29, 2020 Posted December 29, 2020 Merci pour vos messages, mais j'ai cherché partout, c'est vrai que cette fonctionnalité n'existe plus en 1.7. 😕 Share this post Link to post Share on other sites More sharing options...
Alexandre Carette Posted December 31, 2020 Posted December 31, 2020 (edited) Salut, oui c'est possible, je t'ai fais un petit module rapidement <?php /** * 2007-2020 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2020 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) { exit; } class Baba_adress_customer_form extends Module { protected $config_form = false; public function __construct() { $this->name = 'baba_adress_customer_form'; $this->tab = 'administration'; $this->version = '0.0.0'; $this->author = 'Alexandre Carette'; $this->need_instance = 0; /** * Set $this->bootstrap to true if your module is compliant with bootstrap (PrestaShop 1.6) */ $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('baba_adress_customer_form'); $this->description = $this->l('Allow to add adress in customer form.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); } /** * Don't forget to create update methods if needed: * http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update */ public function install() { Configuration::updateValue('BABA_ADRESS_CUSTOMER_FORM_LIVE_MODE', false); return parent::install() && $this->registerHook('actionObjectCustomerAddAfter') && $this->registerHook('additionalCustomerFormFields'); } public function uninstall() { Configuration::deleteByName('BABA_ADRESS_CUSTOMER_FORM_LIVE_MODE'); return parent::uninstall() && $this->unregisterHook('actionBeforeSubmitAccount') && $this->unregisterHook('additionalCustomerFormFields'); } /** * Load the configuration form */ public function getContent() { /** * If values have been submitted in the form, process. */ if (((bool)Tools::isSubmit('submitBaba_adress_customer_formModule')) == true) { $this->postProcess(); } $this->context->smarty->assign('module_dir', $this->_path); $output = $this->context->smarty->fetch($this->local_path.'views/templates/admin/configure.tpl'); return $output.$this->renderForm(); } /** * Create the form that will be displayed in the configuration of your module. */ protected function renderForm() { $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $helper->module = $this; $helper->default_form_language = $this->context->language->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); $helper->identifier = $this->identifier; $helper->submit_action = 'submitBaba_adress_customer_formModule'; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */ 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id, ); return $helper->generateForm(array($this->getConfigForm())); } /** * Create the structure of your form. */ protected function getConfigForm() { return array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs', ), 'input' => array( array( 'type' => 'switch', 'label' => $this->l('Live mode'), 'name' => 'BABA_ADRESS_CUSTOMER_FORM_LIVE_MODE', 'is_bool' => true, 'desc' => $this->l('Use this module in live mode'), 'values' => array( array( 'id' => 'active_on', 'value' => true, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => false, 'label' => $this->l('Disabled') ) ), ), array( 'col' => 3, 'type' => 'text', 'prefix' => '<i class="icon icon-envelope"></i>', 'desc' => $this->l('Enter a valid email address'), 'name' => 'BABA_ADRESS_CUSTOMER_FORM_ACCOUNT_EMAIL', 'label' => $this->l('Email'), ), array( 'type' => 'password', 'name' => 'BABA_ADRESS_CUSTOMER_FORM_ACCOUNT_PASSWORD', 'label' => $this->l('Password'), ), ), 'submit' => array( 'title' => $this->l('Save'), ), ), ); } /** * Set values for the inputs. */ protected function getConfigFormValues() { return array( 'BABA_ADRESS_CUSTOMER_FORM_LIVE_MODE' => Configuration::get('BABA_ADRESS_CUSTOMER_FORM_LIVE_MODE', true), 'BABA_ADRESS_CUSTOMER_FORM_ACCOUNT_EMAIL' => Configuration::get('BABA_ADRESS_CUSTOMER_FORM_ACCOUNT_EMAIL', '[email protected]'), 'BABA_ADRESS_CUSTOMER_FORM_ACCOUNT_PASSWORD' => Configuration::get('BABA_ADRESS_CUSTOMER_FORM_ACCOUNT_PASSWORD', null), ); } /** * Save form data. */ protected function postProcess() { $form_values = $this->getConfigFormValues(); foreach (array_keys($form_values) as $key) { Configuration::updateValue($key, Tools::getValue($key)); } } public function hookActionObjectCustomerAddAfter(array $params) { $company = Tools::getValue('company'); // On ajoute l'adresse du client à la création de l'objet customer // On instancie l'objet Customer qui vient de créer son compte $customer = new Customer((int)$params['object']->id); // On ajoute le nom de sa compagnie $customer->company = $company; // on update le customer $customer->update(); // On ajoute une nouvelle adresse $address = new Address(); // On relie l'adresse au client $address->id_customer = (int)$customer->id; $address->company = $company; $address->alias = Tools::getValue('alias'); $address->vat_number = Tools::getValue('tva'); $address->firstname = $customer->firstname; $address->lastname = $customer->lastname; $address->address1 = Tools::getValue('adress1'); $address->address2 = Tools::getValue('adress2'); //$address->other = "infos complements"; $address->postcode = Tools::getValue('postcode'); $address->city = Tools::getValue('city'); $address->id_country = Tools::getValue('id_country'); $address->phone = Tools::getValue('phone'); $address->add(); } public function hookAdditionalCustomerFormFields() { return [ (new FormField) ->setName('alias') ->setType('text') ->setRequired(true) //Décommenter pour rendre obligatoire ->setLabel($this->l('Alias')), (new FormField) ->setName('company') ->setType('text') ->setRequired(false) //Décommenter pour rendre obligatoire ->setLabel($this->l('Société')), (new FormField) ->setName('tva') ->setType('text') ->setRequired(false) //Décommenter pour rendre obligatoire ->setLabel($this->l('Numéro de TVA')), (new FormField) ->setName('adress1') ->setType('text') ->setRequired(true) //Décommenter pour rendre obligatoire ->setLabel($this->l('Adresse')), (new FormField) ->setName('adress2') ->setType('text') ->setRequired(false) //Décommenter pour rendre obligatoire ->setLabel($this->l('Complément d\'adresse')), (new FormField) ->setName('postcode') ->setType('text') ->setRequired(true) //Décommenter pour rendre obligatoire ->setLabel($this->l('Code Postal')), (new FormField) ->setName('city') ->setType('text') ->setRequired(true) //Décommenter pour rendre obligatoire ->setLabel($this->l('Ville')), (new FormField) ->setName('id_country') ->setRequired(true) ->setType('countrySelect') ->setAvailableValues([ '8' => 'France', '3' => 'Belgique', // Ajouter autant de pays qu'on le souhaite ]) ->setLabel($this->l('Pays')), (new FormField) ->setName('phone') ->setType('text') ->setRequired(false) //Décommenter pour rendre obligatoire ->setLabel($this->l('Téléphone')), ]; } } baba_adress_customer_form.zip Edited December 31, 2020 by Alexandre Carette (see edit history) Share this post Link to post Share on other sites More sharing options...
Alexandre Carette Posted December 31, 2020 Posted December 31, 2020 cdt, Share this post Link to post Share on other sites More sharing options...
jean-seb62 Posted January 6, 2021 Posted January 6, 2021 Bonjour Alexandre, Merci de votre aide ! Mais Où je peux mettre ce fichier ? Dans classes/form ? Cordialement, Jean-Sébastien Share this post Link to post Share on other sites More sharing options...
Alexandre Carette Posted January 6, 2021 Posted January 6, 2021 bonjour c'est un module tu telecharges le zip plus haut et tu l install, cdt Share this post Link to post Share on other sites More sharing options...
jean-seb62 Posted January 6, 2021 Posted January 6, 2021 je n'avais pas vu ce dossier! J'ai réussi à installer et j'ai ajouté plusieurs pays dans ce fichier, et ça marche !! Merci beaucoup ! 1 Share this post Link to post Share on other sites More sharing options...
W-prog Posted March 20, 2021 Posted March 20, 2021 Bonjour, Je m'intéresse à votre module, mais le télécharger n'est plus actif. J'ai essayé de créer le module à la main en faisant un répertoire Baba_adress_customer_form avec dedans un fichier nommé : baba_adress_customer_form.php qui contient le code indiqué. Mais sans succès : module non valide. Pourriez-vous m'aiguiller svp ? Share this post Link to post Share on other sites More sharing options...
Alexandre Carette Posted March 21, 2021 Posted March 21, 2021 Salut W-prog, essaye : https://demo17.baba-agency.com/modules/baba_adress_customer_form.zip cdt Share this post Link to post Share on other sites More sharing options...
W-prog Posted March 21, 2021 Posted March 21, 2021 Hello Alexandre, Merci pour le lien ! super ! Share this post Link to post Share on other sites More sharing options...
hamus Posted June 5, 2021 Posted June 5, 2021 La documentation ne s'affiche pas. Je voudrai modifier les champs à l'inscription. Pouvez-vous me montrer les étapes à suivre pour le faire. Merci en avance. Share this post Link to post 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