Probleme adresse de livraison

4 posts in this topic

Posted · Report post

Bonjour,

Lors d'une commande le Numero du client (CLT2008....) à été entregistré dans l'adresse de livraison (ainsi que dans l'adresse de facturation) en lieu et place du nom et prénom de l'acheteur.

J'ai regardé, mais je ne comprend pas ce qui s'est passé ???

Quelqu'un a-t-il déjà eu ce problème ??

J'ai la version 2.9.

Merci.

Share this post


: post
Share on other sites

Posted · Report post

Personne pour m'aider ??

Share this post


: post
Share on other sites

Posted · Report post

Tu as un bout de code à nous mettre?

Je n'ai pas la même version, chez moi, c'est dans lib/fonctions/fonctions.php et c'est la fonction cree_commande.

Si tu trouves ta fonction, copie-là ici, des fois que l'on trouve ce qui ne va pas.

Share this post


: post
Share on other sites

Posted · Report post

Merci pour la réponse, voici le code de la fonction cree_commande :

function cree_commande(&$commande) {

// Enregistre la commande dans la base 



	global $normal;

	global $express;

	global $site;

	global $support;

	global $wwwroot;

	global $seuil;

	global $affiliate_rate;


	$remise = 0;	


	$tab_pays1 = mysql_fetch_array(mysql_query("SELECT pays_".$_SESSION['langue']." FROM peel_pays WHERE id = '".$commande['pays1']."'"));


	// Constuit les infos du client en une chaîne

	// Addresse de facturation

	$client_info1 =

		 $commande['client1']."\n"

		.$commande['adresse1']."\n"

		.$commande['code_postal1']."\n"

		.$commande['ville1']."\n"

		.$tab_pays1['pays_'.$_SESSION['langue'].'']."\n"


		.$commande['contact1']."\n"

		.$commande['email1']."\n";



	$coord1 = explode(" ",  $commande['client1']);



	if (empty($commande['adresse2']) || empty($commande['code_postal2']) || empty($commande['ville2'])) {

	// Addresse de livraison


	$client_info2 =

		 $commande['client1']."\n"

		.$commande['adresse1']."\n"

		.$commande['code_postal1']."\n"

		.$commande['ville1']."\n"

		.$_SESSION['caddie']->pays."\n"

		.$commande['contact1']."\n"

		.$commande['email1']."\n";	


	} else {


	// Addresse de livraison

	$client_info2 =

		 $commande['client2']."\n"

		.$commande['adresse2']."\n"

		.$commande['code_postal2']."\n"

		.$commande['ville2']."\n"

		.$_SESSION['caddie']->pays."\n"

		.$commande['contact2']."\n"

		.$commande['email2']."\n";	


	}


	$coord1 = explode(" ",  $commande['client1']);


	$coord2 = explode(" ",  $commande['client2']);


	/* Le reversement affilié est calculé sur le total ht des produits */

	if (isset($_SESSION['affilie'])) {	$affilie = 1; $statut_affilie = 0;	$montant_affilie = $_SESSION['caddie']->total_produit_ht * $affiliate_rate/100; } else { $affilie = 0; $montant_affilie = 0; $statut_affilie = 0;}



	$sql = "

	INSERT INTO peel_commandes (

		email

		, id_utilisateur

		, o_timestamp


		, a_timestamp


		, statut

		, statut_details


		, client_info1

		, client_info2

		, commentaires


		, montant

		, montant_ht

		, total_tva

		, tva_transport

		, total_produit_avant_promo

		, total_produit_avant_promo_ht


		, total_produit


		, type

		, zone

		, zone_tva

		, pays

		, transport

		, cout_transport

		, cout_transport_ht


		, lang

		, points

		, points_etat

		, poids


		, affilie

		, montant_affilie

		, statut_affilie

		, remise_produit

		, remise_produit_ht

		, remise_client

		, remise_client_ht

		, remise_client_percent


		, remise_code

		, remise_code_ht

		, remise_code_percent

		, code_promo


		, code_cheque_cadeau

		, remise_cheque

		, remise_cheque_ht


		, code_bon

		, remise_bon

		, remise_bon_ht


		, avoir


		, paiement

		, tarif_paiement


		, prenom_bill

		, nom_bill

		, adresse_bill

		, zip_bill

		, ville_bill

		, pays_bill

		, email_bill

		, telephone_bill

		, prenom_ship

		, nom_ship

		, adresse_ship

		, zip_ship

		, ville_ship

		, pays_ship

		, email_ship

		, telephone_ship


		, id_parrain

		, parrain


		, ecotaxe_ttc

		, ecotaxe_ht


	) VALUES (

		 '{$_SESSION['utilisateur']['email']}'

		,'".intval($_SESSION['utilisateur']['id_utilisateur'])."'

		,now()

		,now()

		,0

		,'commande initialisée'

		,'".htmlspecialchars($client_info1, ENT_QUOTES)."'

		,'".htmlspecialchars($client_info2, ENT_QUOTES)."'

		,'".htmlspecialchars($commande['commentaires'], ENT_QUOTES)."'

		,'".$_SESSION['caddie']->total."'

		,'".$_SESSION['caddie']->total_ht."'

		,'".$_SESSION['caddie']->total_tva."'

		,'".$_SESSION['caddie']->tva_transport."'

		,'".$_SESSION['caddie']->total_produit_avant_promo."'

		,'".$_SESSION['caddie']->total_produit_avant_promo_ht."'

		,'".$_SESSION['caddie']->total_produit."'

		,'".htmlspecialchars($_SESSION['caddie']->type,ENT_QUOTES)."'

		,'".htmlspecialchars($_SESSION['caddie']->zone,ENT_QUOTES)."'

		,'".intval($_SESSION['caddie']->zoneTva)."'

		,'".htmlspecialchars($_SESSION['caddie']->pays,ENT_QUOTES)."'

		,'".htmlspecialchars($_SESSION['caddie']->zone,ENT_QUOTES)." - ".htmlspecialchars($_SESSION['caddie']->type,ENT_QUOTES)."'

		,'".$_SESSION['caddie']->cout_transport."'

		,'".$_SESSION['caddie']->cout_transport_ht."'

		,'".$_SESSION['langue']."'

		,'".$_SESSION['caddie']->total_points."'

		,'0'

		,'".$_SESSION['caddie']->total_poids."'

		,'".$affilie."'

		,'".$montant_affilie."'

		,'".$statut_affilie."'


		,'".$_SESSION['caddie']->total_remise_produit."'

		,'".$_SESSION['caddie']->total_remise_produit_ht."'

		,'".$_SESSION['caddie']->total_remise_client."'

		,'".$_SESSION['caddie']->total_remise_client_ht."'

		,'".$_SESSION['caddie']->remise_client_percent."'


		,'".$_SESSION['caddie']->total_remise_code."'

		,'".$_SESSION['caddie']->total_remise_code_ht."'

		,'".$_SESSION['caddie']->remise_code_percent."'

		,'".htmlspecialchars($_SESSION['caddie']->code_promo,ENT_QUOTES)."'


		,'".htmlspecialchars($_SESSION['caddie']->code_cheque,ENT_QUOTES)."'

		,'".$_SESSION['caddie']->total_remise_cheque."'

		,'".$_SESSION['caddie']->total_remise_cheque_ht."'


		,'".htmlspecialchars($_SESSION['caddie']->code_bon,ENT_QUOTES)."'

		,'".$_SESSION['caddie']->total_remise_bon."'

		,'".$_SESSION['caddie']->total_remise_bon_ht."'


		,'".$_SESSION['caddie']->avoir."'


		,'".htmlspecialchars($_SESSION['caddie']->paiement,ENT_QUOTES)."'

		,'".$_SESSION['caddie']->tarif_paiement."'

		, '".htmlspecialchars(vb($coord1[0]),ENT_QUOTES)."'

		, '".htmlspecialchars(vb($coord1[1]),ENT_QUOTES)."'

		, '".htmlspecialchars($commande['adresse1'],ENT_QUOTES)."'

		, '".htmlspecialchars($commande['code_postal1'])."'

		, '".htmlspecialchars($commande['ville1'],ENT_QUOTES)."'

		, '".htmlspecialchars($tab_pays1['pays_'.$_SESSION['langue'].''],ENT_QUOTES)."'

		, '".htmlspecialchars($commande['email1'])."'

		, '".htmlspecialchars($commande['contact1'])."'

		, '".htmlspecialchars(vb($coord2[0]),ENT_QUOTES)."'

		, '".htmlspecialchars(vb($coord2[1]),ENT_QUOTES)."'

		, '".htmlspecialchars($commande['adresse2'],ENT_QUOTES)."'

		, '".htmlspecialchars($commande['code_postal2'])."'

		, '".htmlspecialchars($commande['ville2'],ENT_QUOTES)."'

		, '".htmlspecialchars($_SESSION['caddie']->pays,ENT_QUOTES)."'

		, '".htmlspecialchars($commande['email2'])."'

		, '".htmlspecialchars($commande['contact2'])."'


		,'".vn($_SESSION['utilisateur']['id_parrain'])."'

		,'".vb($_SESSION['utilisateur']['type'])."'


		,'".$_SESSION['caddie']->ecotaxe_ttc."'

		,'".$_SESSION['caddie']->ecotaxe_ht."'




		)";



	$qid = mysql_query($sql) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());


	$commandeid = mysql_insert_id();


	mysql_query("UPDATE peel_utilisateurs SET avoir = avoir - '".vn($_SESSION['caddie']->avoir)."', parrain = '' WHERE id_utilisateur = '".intval($_SESSION['utilisateur']['id_utilisateur'])."'");



	if (isset($_SESSION['affilie'])) {


		mysql_query("INSERT INTO peel_utilisateurs_commandes (utilisateur_id, commande_id) VALUES ('".$_SESSION['affilie']."', '".$commandeid."')");


	 }



	if (!empty($_SESSION['caddie']->code_cheque)) {


		mysql_query("UPDATE peel_cheques_cadeaux SET a_timestamp = now(), etat = '0' WHERE code = '".$_SESSION['caddie']->code_cheque."'");


	}	



	/* ajout des articles à la table commandes_articles */

	foreach ($_SESSION['caddie']->articles as $i => $produitid) {			


		$qid = mysql_query("SELECT * FROM peel_produits WHERE id= '$produitid'");


			if ($qid) {


				if (mysql_num_rows($qid) > 0) {


				$article=mysql_fetch_array($qid);	


				if ($article['on_stock'] == 1) {


				$c = mysql_fetch_array(mysql_query("SELECT id FROM peel_couleurs WHERE nom_".$_SESSION['langue']." = '".$_SESSION['caddie']->couleur[$i]."'"));


				$t = mysql_fetch_array(mysql_query("SELECT id FROM peel_tailles WHERE nom_".$_SESSION['langue']." = '".$_SESSION['caddie']->taille[$i]."'"));



				$s = mysql_fetch_array(mysql_query("SELECT stock FROM peel_stocks WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'"));


				$stock = $s['stock'] - $_SESSION['caddie']->quantite[$i];


				if ($stock >= 0) { $stock_restant = $stock; } else {	$stock_restant = 0;	}


				if ($stock < 0) { 


				$stock_to_order = $_SESSION['caddie']->quantite[$i] - $s['stock']; /* Calcul le stock restant à commander */


				mysql_query("UPDATE peel_commandes SET statut = '9' WHERE id = '".$commandeid."'"); /* Passage de la commande en stand by */


				} else {	


				$stock_to_order = 0;	


				}


				mysql_query("UPDATE peel_stocks SET stock = ".$stock_restant." WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'");


				$sqlStockTemp = "SELECT stock, qte FROM peel_stocks_temp WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'";


				$resStockTemp = mysql_query($sqlStockTemp);


				$StockTemp = mysql_fetch_array($resStockTemp);


				if ($StockTemp['qte'] == $_SESSION['caddie']->quantite[$i]) {


				mysql_query("DELETE FROM peel_stocks_temp WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'");


				} else {


				mysql_query("UPDATE peel_stocks_temp SET stock = ".$stock_restant.", qte = qte - ".$_SESSION['caddie']->quantite[$i].", o_timestamp = now() WHERE produit_id = '".$article['id']."' AND couleur_id = '".vn($c['id'])."' AND taille_id = '".vn($t['id'])."'");



				}




				if ($s['stock'] <= $seuil) {


				mail("$support","[$site] Notification d'alerte STOCK","Seuil d'alerte atteint pour le produit ".html_entity_decode($article['nom_'.$_SESSION['langue'].''])."\n\r Couleur : ".$_SESSION['caddie']->couleur[$i]."\n\r Taille : ".$_SESSION['caddie']->taille[$i]."\n\r Stock restant : ".$s['stock']."\n\r","FROM:$support");


				}


				}



				$statut_envoi = ($article['on_download'] == 1) ? "En attente" : "";


				$requete = 	"INSERT INTO peel_commandes_articles (

					commande_id

					, produit_id

					, nom_produit

					, prix_cat

					, prix_cat_ht

					, prix

					, prix_ht

					, total_prix

					, total_prix_ht

					, quantite

					, promotion

					, remise_produit

					, tva

					, tva_percent

					, couleur

					, taille

					, comment

					, option_prix

					, delivery_stock

					, order_stock

					, points

					, poids

					, email_check

					, on_download

					, statut_envoi

					, nb_envoi

					, nb_download

				) VALUES (

					 '$commandeid'

					,'".$article['id']."'

					,'".htmlspecialchars($article['nom_'.$_SESSION['langue'].''], ENT_QUOTES)."'

					,'".$_SESSION['caddie']->prix_cat[$i]."'

					,'".$_SESSION['caddie']->prix_cat_ht[$i]."'

					,'".$_SESSION['caddie']->prix[$i]."'

					,'".$_SESSION['caddie']->prix_ht[$i]."'

					,'".$_SESSION['caddie']->total_prix[$i]."'

					,'".$_SESSION['caddie']->total_prix_ht[$i]."'

					,'".$_SESSION['caddie']->quantite[$i]."'

					,'".$_SESSION['caddie']->remise_produit_percent[$i]."'

					,'".$_SESSION['caddie']->remise_produit[$i]."'

					,'".$_SESSION['caddie']->tva[$i]."'

					,'".$_SESSION['caddie']->tva_percent[$i]."'

					,'".htmlspecialchars($_SESSION['caddie']->couleur[$i])."'

					,'".htmlspecialchars($_SESSION['caddie']->taille[$i])."'

					,'".htmlspecialchars($_SESSION['caddie']->comment[$i])."'

					,'".htmlspecialchars($_SESSION['caddie']->option[$i])."'

					,'".htmlspecialchars($_SESSION['caddie']->delivery_stock[$i])."'

					,'".intval(vn($stock_to_order))."'

					,'".htmlspecialchars($_SESSION['caddie']->points[$i])."'

					,'".htmlspecialchars($_SESSION['caddie']->poids[$i])."'

					,'".htmlspecialchars($_SESSION['caddie']->email_check[$i])."'

					,'".intval($article['on_download'])."'

					,'".$statut_envoi."'

					,'0'

					,'0'

				)";


				mysql_query($requete) or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());


				if (!empty($_SESSION['caddie']->email_check[$i])) {


					$code = strtoupper(MDP());


					$email_client = $_SESSION['utilisateur']['email'];


					$email_ami = $_SESSION['caddie']->email_check[$i];


					/* Mode production : mettre l'état à 0 et passer les fonctions mails dans la liste des chèques cadeaux */



					mysql_query("INSERT INTO peel_cheques_cadeaux (

					id_utilisateur, 

					email_acheteur, 

					email_ami, 

					nom_produit, 

					code, 

					remise_cheque, 

					o_timestamp,

					seuil,

					etat

					) VALUES (

					'".intval($_SESSION['utilisateur']['id_utilisateur'])."',

					'$email_client', 

					'$email_ami', 

					'".htmlspecialchars($article['nom_'.$_SESSION['langue'].''], ENT_QUOTES)."',

					'".$code."',

					'".$_SESSION['caddie']->prix[$i]."', 

					now(),

					'".$_SESSION['caddie']->prix[$i]."', 

					'1')")

					or DIE('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());



					$message = "Bonjour,\n\r";

					$message .= "Votre ami ".$_SESSION['utilisateur']['prenom']." ".$_SESSION['utilisateur']['nom_famille']." a souhaité vous offrir un chèque cadeau sur le site $site.\n\r";

					$message .= "Pour en bénéficier, connectez vous simplement au site $wwwroot et utilisez votre code $code.\n\rVous bénéficierez alors d'un avoir de ".$_SESSION['caddie']->prix[$i]." EURO TTC sur votre commande.\n\r";

					$message .= "A bientôt sur $site.";


					mail($email_ami,"[$site] ".$_SESSION['utilisateur']['email']." vous offre un chèque cadeau",$message,"FROM:$email_client");

					mail($email_client ,"[$site - copie du message envoyé à ".$_SESSION['caddie']->email_check[$i]."] ".$_SESSION['utilisateur']['email']." vous offre un chèque cadeau",$message,"FROM:$support");


					$message_support = "Bonjour,\n\rLe code chèque cadeau $code vient d'être créé sur $site.\n\r Merci de le valider à réception du règlement.";

					mail($support ,"[$site] Création d'un chèque cadeau à valider",$message_support,"FROM:$support");


				}



			}

		}

	}



	/* Annule la remise en % du client, supprimer ces lignes si vous souhaitez que les remises client soient permanentes */

	mysql_query("UPDATE peel_utilisateurs SET remise_percent = '0', avoir = '0'  WHERE id_utilisateur = '".$_SESSION['utilisateur']['id_utilisateur']."'");


	$_SESSION['utilisateur']['remise_percent'] = 0;

	$_SESSION['utilisateur']['avoir'] = 0;

	$_SESSION['utilisateur']['id_parrain'] = 0;

	$_SESSION['utilisateur']['type'] = ''; #- Suppression du statut filleul


	return $commandeid;


}

Share this post


: post
Share on other sites

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

Twitter Advisto ecommerce

Facebook PEEL Shopping