jd440 Posted January 22, 2016 Share Posted January 22, 2016 (edited) Bonjour à tous, Comme tout le monde je suppose il arrive que les clients inverse leur prénom et nom. Je prévoie donc d'ajouter une fonctionnalité qui puisse les inverser. Mais afin de ne pas faire du travaille inutilse est ce que quelqu'un aurais cela sous le coude? Edited January 22, 2016 by jd440 (see edit history) Link to comment Share on other sites More sharing options...
franckm1000 Posted January 22, 2016 Share Posted January 22, 2016 Directement en base il suffirait de faire: update ps_customer set firstname=lastname, lastname=firstname where id_customer=XXXXXX Où ID_CUSTOMER est visible dans la liste de clients. Après, peut-être un petit module le fait déjà ? 1 Link to comment Share on other sites More sharing options...
jd440 Posted January 22, 2016 Author Share Posted January 22, 2016 Je te remercie c'est ce que je viens de faire. par un jolie petit ovveridede la classe customer public function processInvertName($id_customer) { $nom_erronne = Db::getInstance()-> executeS('SELECT `firstname`,`lastname` FROM `ps_customer` WHERE `id_customer` = '.$id_customer); $nom = $nom_erronne[0]['firstname']; $prenom = $nom_erronne[0]['lastname']; Db::getInstance()->execute('UPDATE `ps_customer` SET `lastname`=@tmp:=`lastname`, `lastname`=`firstname`, `firstname`=@tmp WHERE `id_customer` = '.$id_customer); if(Db::getInstance()->getValue('SELECT * FROM `ps_address` WHERE `id_customer` = '.$id_customer.' AND `firstname` = \''.$nom.'\' AND `lastname` = \''.$prenom.'\'')) Db::getInstance()->execute('UPDATE `ps_address` SET `lastname`=@tmp:=`lastname`, `lastname`=`firstname`, `firstname`=@tmp WHERE `id_customer` = '.$id_customer.' AND `firstname` = \''.$nom.'\' AND `lastname` = \''.$prenom.'\''); [..] } Link to comment Share on other sites More sharing options...
akhawat Posted December 22, 2016 Share Posted December 22, 2016 Bonjour je suis en 1.5.6.1 et je suis interessé par cette modification, pouvez vous me dire comment faire l'override ? s'il vous plait cdlt 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