Jump to content

[Resolut] Nversion Nom Prénom


jd440
 Share

Recommended Posts

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 by jd440 (see edit history)

Share this post


Link to post
Share on other sites

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à ?

  • Like 1

Share this post


Link to post
Share on other sites

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`[email protected]:=`lastname`, `lastname`=`firstname`, `firstname`[email protected] 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`[email protected]:=`lastname`, `lastname`=`firstname`, `firstname`[email protected]  WHERE `id_customer` = '.$id_customer.' AND `firstname` = \''.$nom.'\' AND `lastname` = \''.$prenom.'\'');

		[..]
	}

Share this post


Link to post
Share on other sites

  • 10 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More