modelike Posted April 27, 2017 Share Posted April 27, 2017 Bonsoir à toutes et à tous. J'ai besoin de votre aide. J'ai crée donc ma boutique de produits dématérialisés. Il me faudrait donc pouvoir alléger le formulaire d'inscription à... presque rien en fait. En effet, il me faudrait uniquement son email, le prénom de la personne, son code postal, sa ville et son pays. Mais, quels fichiers de prestashop 1.6.1.12 dois-je modifier ? J'ai suivi les différents tutoriels visibles sur le web et conseillant de modifier par exemple le fichier identity.tpl de mon thème mais rien n'y fait, quand j'essaie de créer un client, tout est demandé... Pourriez vous m'aider ? A savoir que mes produits dématérialisés seront (pour le moment en tout cas) tous gratuits et donc je n'ai pas besoin d'informations de facturation, pire, cela pourrait freiner les personnes... Merci ! Link to comment Share on other sites More sharing options...
Alexandre Carette Posted April 28, 2017 Share Posted April 28, 2017 Salut, j'avais besoin de la meme modif pour mon site je te file ce que j'ai fais: 1) override de AuthController.php <?php /* * 2007-2016 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 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/osl-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-2016 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AuthController extends AuthControllerCore { public function postProcess() { parent::postProcess(); if (Tools::isSubmit('submitAccountModal')) { $this->processSubmitAccountModal(); } } protected function processSubmitAccountModal() { //On recupere les inputs $group = Tools::getValue('group'); $password = trim(Tools::getValue('passwd')); $_POST['passwd'] = null; $email = trim(Tools::getValue('email')); $postcode = trim(Tools::getValue('customer_postcode')); $prenom = trim(Tools::getValue('customer_firstname')); $nom = trim(Tools::getValue('customer_lastname')); $fonction = trim(Tools::getValue('customer_fonction')); $phone = trim(Tools::getValue('customer_phone')); $denomination = trim(Tools::getValue('customer_denomination')); $siret = trim(Tools::getValue('customer_siret')); $website = trim(Tools::getValue('customer_website')); $address1 = Tools::getValue('customer_address'); $address2 = Tools::getValue('customer_address2'); $ville = trim(Tools::getValue('customer_city')); //On vérifie les inputs if (empty($email)) { $this->errors[] = Tools::displayError('An email address required.'); } elseif (!Validate::isEmail($email)) { $this->errors[] = Tools::displayError('Invalid email address.'); } elseif (empty($password)) { $this->errors[] = Tools::displayError('Password is required.'); } elseif (!Validate::isPasswd($password)) { $this->errors[] = Tools::displayError('Invalid password.'); } elseif (empty($postcode)) { $this->errors[] = Tools::displayError('A Zip / Postal code is required.'); } elseif ($postcode && !Validate::isPostCode($postcode)) { $this->errors[] = Tools::displayError('The Zip / Postal code is invalid.'); } elseif (empty($prenom)) { $this->errors[] = Tools::displayError('Prénom obligatoire'); } elseif ($prenom && !Validate::isGenericName($prenom)) { $this->errors[] = Tools::displayError('Prénom invalide'); } elseif (empty($nom)) { $this->errors[] = Tools::displayError('Nom obligatoire'); } elseif ($nom && !Validate::isGenericName($nom)) { $this->errors[] = Tools::displayError('Nom invalide'); } elseif (empty($fonction)) { $this->errors[] = Tools::displayError('Fonction obligatoire'); } elseif ($fonction && !Validate::isGenericName($fonction)) { $this->errors[] = Tools::displayError('Fonction invalide'); } elseif (empty($phone)) { $this->errors[] = Tools::displayError('Téléphone obligatoire'); } elseif ($phone && !Validate::isPhoneNumber($phone)) { $this->errors[] = Tools::displayError('Téléphone invalide'); } elseif (empty($denomination)) { $this->errors[] = Tools::displayError('La dénomisation de votre entreprise est obligatoire'); } elseif ($denomination && !Validate::isGenericName($denomination)) { $this->errors[] = Tools::displayError('Dénomisation invalide'); } elseif (empty($siret)) { $this->errors[] = Tools::displayError('SIRET obligatoire'); } elseif ($siret && !Validate::isSiret($siret)) { $this->errors[] = Tools::displayError('SIRET invalide'); } elseif ($website && !Validate::isUrl($website)) { $this->errors[] = Tools::displayError('Website invalide'); } elseif (empty($address1)) { $this->errors[] = Tools::displayError('Addresse obligatoire'); } elseif ($address1 && !Validate::isAddress($address1)) { $this->errors[] = Tools::displayError('Addresse invalide'); } elseif ($address2 && !Validate::isAddress($address2)) { $this->errors[] = Tools::displayError('Addresse complément invalide'); } elseif (empty($ville)) { $this->errors[] = Tools::displayError('Ville obligatoire'); } elseif ($ville && !Validate::isCityName($ville)) { $this->errors[] = Tools::displayError('Ville invalide'); } elseif (empty($website)) { $this->errors[] = Tools::displayError('Site internet obligatoire'); } elseif ($website && !Validate::isUrl($website)) { $this->errors[] = Tools::displayError('Site internet invalide'); } else { // Checked the user address in case he changed his email address if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email)) { if (Customer::customerExists($email)) { $this->errors[] = Tools::displayError('Un compte utilisant cette adresse email existe déjà !', false); } else { Customer::registerAccountModal($group,$prenom,$nom,$fonction,$phone,$email,$password,$denomination,$siret,$website); Address::registerAddressModal($prenom,$nom,$phone,$denomination,$siret,$address1,$address2,$postcode,$ville); Tools::redirect('index.php'); } } } } } 2) override de la classe Customer.php <?php /* * 2007-2016 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 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/osl-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-2016 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class Customer extends CustomerCore { public static function registerAccountModal($group,$prenom,$nom,$fonction,$phone,$email,$password,$denomination,$siret,$website) { $passwd = md5(_COOKIE_KEY_.$password); $customer = new Customer(); $customer->passwd = $passwd; $customer->email = $email; $customer->firstname = $prenom; $customer->lastname = $nom; $customer->website = $website; $customer->company = $denomination; $customer->siret = $siret; $customer->active = 1; $customer->newsletter = 0; $customer->id_default_group = 3; // Ca marche $customer->add(); $customer->cleanGroups(); $customer->addGroups(array(3,2,1)); $context = Context::getContext(); $context->cookie->__set('id_customer' , $customer->id); $context->cookie->__set('id_group_default' , $customer->id_default_group); $context->cookie->__set('customer_lastname' , $customer->lastname); $context->cookie->__set('customer_firstname' , $customer->firstname); $context->cookie->__set('passwd' , $customer->passwd); $context->cookie->__set('logged' , 1); $context->cookie->__set('email' , $customer->email); $context->cart->secure_key = $customer->secure_key; } } 3) override de la classe Adress.php <?php /** * 2007-2016 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 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/osl-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-2016 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class Address extends AddressCore { /** * Returns address informations * @since 1.5.0 * @param int $id_customer * @return array */ public static function getCustomerAddress($id_customer) { $query = new DbQuery(); $query->select('*'); $query->from('address'); $query->where('deleted = 0'); $query->where('active = 1'); $query->where('id_customer = '.(int)$id_customer); return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); } public static function registerAddressModal($prenom,$nom,$phone,$denomination,$siret,$address1,$address2,$postcode,$ville) { $curr_timestamp = date('Y-d-m H:i:s'); $context = Context::getContext(); $id_customer = (int)$context->cookie->id_customer; $address = new Address(); $address->id_customer = $id_customer; $address->id_country = 8; $address->country = 'France'; $address->alias = 'Siège social'; $address->company = $denomination; $address->lastname = $nom; $address->firstname = $prenom; $address->address1 = $address1; $address->address2 = $address2; $address->postcode = $postcode; $address->city = $ville; $address->phone = $phone; $address->date_add = $curr_timestamp; $address->date_upd = $curr_timestamp; $address->add(); } } 4) le code d'une modal est injecté dans le footer.tpl <!-- Login Modal --> <div class="modal fade" id="signupModal"> <form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Fermer</span></button> <h4 class="modal-title">Devenir client</h4> </div> <div class="modal-body"> <div class="col-md-6"> <div class="required form-group"> <input placeholder="{l s='Dénomination entreprise'}*" type="text" class="is_required validate form-control" id="customer_denomination" name="customer_denomination" value="" /> </div> <div class="required form-group"> <input placeholder="{l s='Nom'}*" onkeyup="$('#firstname').val(this.value);" type="text" class="is_required validate form-control" data-validate="isName" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.post.customer_firstname)}{$smarty.post.customer_firstname}{/if}" /> </div> <div class="required form-group"> <input placeholder="{l s='Prénom'}*" onkeyup="$('#lastname').val(this.value);" type="text" class="is_required validate form-control" data-validate="isName" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" /> </div> <div class="presta required form-group"> <input placeholder="{l s='Fonction'}*" type="text" class="form-control" id="customer_fonction" name="customer_fonction" value="" /> </div> <div class="required form-group"> <input placeholder="{l s='Téléphone'}*" type="text" class="is_required validate form-control" id="customer_phone" name="customer_phone" value="" /> </div> <div class="required form-group"> <input placeholder="{l s='E-mail du contact'}*" type="email" class="is_required validate form-control" data-validate="isEmail" id="email" name="email" value="{if isset($smarty.post.email)}{$smarty.post.email}{/if}" /> </div> <div class="required password form-group"> <input placeholder="{l s='Password'}*" type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" /> </div> </div> <div class="col-md-6"> <div class="required form-group"> <input placeholder="{l s='SIRET'}*" type="text" class="is_required validate form-control" id="customer_siret" name="customer_siret" value="" /> </div> <div class="required form-group"> <input placeholder="{l s='Site internet'}*" type="text" class="is_required validate form-control" id="customer_website" name="customer_website" value="" /> </div> <div class="presta required form-group"> <input placeholder="{l s='Adresse de facturation'}*" type="text" class="form-control" id="customer_address" name="customer_address" value="" /> </div> <div class="presta required form-group"> <input placeholder="{l s='Adresse complément'}" type="text" class="form-control" id="customer_address2" name="customer_address2" value="" /> </div> <div class="presta required form-group"> <input placeholder="{l s='Code postal'}*" type="text" class="form-control" id="customer_postcode" name="customer_postcode" value="" /> </div> <div class="presta required form-group"> <input placeholder="{l s='Ville'}*" type="text" class="form-control" id="customer_city" name="customer_city" value="" /> </div> <div class="required select form-group"> <select name="id_country" id="id_country" class="form-control"> <option value="1">France</option> </select> </div> </div> <div class="col-md-4 pull-right text-right"> <input type="hidden" name="email_create" value="1" /> <input type="hidden" name="is_new_customer" value="1" /> <button type="submit" name="submitAccountModal" id="submitAccountModal" class="btn btn-default"> <span>{l s='Envoyer'}</span> </button> <sup>*</sup>{l s='Requis'} </div> </div> <div class="modal-footer"> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </form> </div><!-- /.modal --> cdt Link to comment Share on other sites More sharing options...
modelike Posted May 2, 2017 Author Share Posted May 2, 2017 Merci J'avais trouvé puis j'ai décidé de mettre à jour mon site vers la version 1.7.1... Quelle erreur puisque tout ça a changé et que je ne m'y retrouve encore une fois plus... 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