Jump to content

[Resolut] Nversion Nom Prénom


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)
Link to comment
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`=@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

  • 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
×
×
  • Create New...