j'ai un souci, j'ai un caddi avec mes lignes de commande et un formulaire pour le client remplisse ces coordonnées. La commande est envoyée directement par email au magasin avec les coordonnées du client et le résumé de la commande. Et le problème est que je n'arrive pas à ce que les lignes de la commande soit afficher dans cette email,il n'y a que la 1ere ligne de la commande qui vient inscrire. faut-il faire une boucle? Ainsi que les totaux, les quantités total...
Je vous mets mon code source de la dernière page de validation du caddie et pour l'envoi de l'email...
Merci bcp de votre aide
<?
session_start();
?>
<?php require_once('../Connections/lolipop.php'); ?>
<?php
// Load the common classes
require_once('../includes/common/KT_common.php');
// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');
// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("../");
// Make unified connection variable
$conn_lolipop = new KT_connection($lolipop, $database_lolipop);
// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("nom", true, "text", "", "", "", "");
$formValidation->addField("prenom", true, "text", "", "", "", "");
$tNGs->prepareValidation($formValidation);
// End trigger
//start Trigger_SendEmail trigger
//remove this line if you want to edit the code by hand
function Trigger_SendEmail(&$tNG) {
$emailObj = new tNG_Email($tNG);
$emailObj->setFrom("{nom}");
$emailObj->setTo("[email protected]");
$emailObj->setCC("");
$emailObj->setBCC("");
$emailObj->setSubject("Formulaire en ligne");
//WriteContent method
$emailObj->setContent("Vous avez recu une demande du formulaire Internet : \n<br>Coordonnées de la personne : \n\n<P>{nom}</P>\n<P>{prenom}</P>\nArticle commande : {\$cde}/{Recordset1.MODELE_ARTICLE}/{Recordset1.PRIX_ARTICLE}/{Recordset1.COULEUR_ARTICLE}/{Recordset1.TAILLE_ARTICLE}\n\n\n\n\n");
$emailObj->setEncoding("ISO-8859-1");
$emailObj->setFormat("HTML/Text");
$emailObj->setImportance("High");
return $emailObj->Execute();
}
//end Trigger_SendEmail trigger
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_lolipop, $lolipop);
$query_Recordset1 = "SELECT * FROM APPLI_ARTICLE";
$Recordset1 = mysql_query($query_Recordset1, $lolipop) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
// Make a custom transaction instance
$customTransaction = new tNG_custom($conn_lolipop);
$tNGs->addTransaction($customTransaction);
// Register triggers
$customTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Custom1");
$customTransaction->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$customTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "form_valid.php");
$customTransaction->registerTrigger("AFTER", "Trigger_SendEmail", 98);
// Add columns
$customTransaction->addColumn("nom", "STRING_TYPE", "POST", "nom");
$customTransaction->addColumn("prenom", "STRING_TYPE", "POST", "prenom");
// End of custom transaction instance
// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset
$rscustom = $tNGs->getRecordset("custom");
$row_rscustom = mysql_fetch_assoc($rscustom);
$totalRows_rscustom = mysql_num_rows($rscustom);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Loli-pop : Mode, Skate, Kite, Snowboard</title>
<link href="../css/styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #333333;
}
-->
</style>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../includes/skins/style.js" type="text/javascript"></script>
<?php echo $tNGs->displayValidationRules();?>
</head>
<body scroll="auto">
<div class="main" id="main">
<div class="main2" id="contenu2">
<p align="center"> </p>
<p align="center"><img src="../images/flash_part.jpg" width="821" height="279" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="143,225,247,269" href="../events.php" />
<area shape="rect" coords="488,228,573,271" href="../marques.php" />
<area shape="rect" coords="638,234,706,267" href="../contact.php" />
<area shape="rect" coords="360,231,482,266" href="http://www.loli-pop.ch/Gallery" target="_blank" />
<area shape="rect" coords="576,231,637,266" href="../liens.php" />
<area shape="rect" coords="7,7,808,229" href="../index.php" />
</map>
</p>
<?
if( isset($_SESSION['panier'])){
$panier = $_SESSION['panier'];
$tot=0;// initialisation du total.
$tottot=0; // initialisation au total 2
?>
<link href="../css/styles.css" rel="stylesheet" type="text/css" />
<div align="center"><H2 class="titre"> Contenu de votre Caddie</H2>
</div>
<table border="0" align="center" bgcolor="FFFFCC" width="50%" class="description">
<tr bgcolor='white'>
<td width="" bgcolor="#FFFF99" class="shop_text">Article</td>
<td width="" bgcolor="#FFFF99" class="shop_text">Quantité </td>
<td width="" bgcolor="#FFFF99" class="shop_text">Prix unité </td>
<td width="" bgcolor="#FFFF99" class="shop_text">Total </td>
<td width="" bgcolor="#FFFF99" class="shop_text"> </td>
</tr>
<form method="POST" action="panier4_2.php">
<?
$connexion = mysql_connect("localhost","lolipop","yxasqw12")
or exit("Erreur 101") ;
mysql_select_db( "lolipop" , $connexion)
or exit("Erreur 102") ;
foreach ($panier as $valeur=>$cde){
$sql="select * from APPLI_ARTICLE where ID_ARTICLE='$valeur'";
$req=mysql_query($sql)or exit ('Erreur SQL !'.$sql.'<br>'.mysql_error());
while( $data=mysql_fetch_array($req) ){
$MODELE_ARTICLE=$data['MODELE_ARTICLE'];//nom de l'article
$PRIX_ARTICLE=$data['PRIX_ARTICLE'];// prix unitaire
$pxligne=$PRIX_ARTICLE*$cde; //prix pour la ligne de commande
$tot+=$pxligne;// total général sans les frais de livraison
$tottot=$tot+20;//total avec frais de livraison
echo"<tr><td>$MODELE_ARTICLE</td><td>$cde</td><td>$PRIX_ARTICLE</td><td align='right'>$pxligne</td><td><input type='checkbox' name='case[]' value='".$data['ID_ARTICLE']."'></td></tr>";
}
}
;
echo"<tr><td colspan='3' align='right'><b>Total Commandé...</b></td><td align='right'><b>$tot</b></td><td> </td></tr>";
echo"<tr><td colspan='3' align='right'><b>Frais de livraison(offert à partir de Frs 100.-)</b></td><td align='right'><b>20</b></td><td> </td></tr>";
echo"<tr><td colspan='3' align='right'><b>Total de la commande</b></td><td align='right'><b>$tottot</b></td><td> </td></tr>";
mysql_close();}
?>
<tr bgcolor='white'>
<td colspan="5" align="right"><input type="submit" name="action" value="Supprimer"> <input type="submit" name="action" value="Changer"></td></tr>
<tr bgcolor='white'>
<td colspan="5" align="right"> </td>
</tr>
<tr bgcolor='white'>
<td colspan="5" align="right"> </td>
</tr>
</table>
</form>
<form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
<table cellpadding="2" cellspacing="0">
<tr>
<td class="KT_th"><label for="nom">Nom:</label></td>
<td><input type="text" name="nom" id="nom" value="<?php echo KT_escapeAttribute($row_rscustom['nom']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("nom");?> <?php echo $tNGs->displayFieldError("custom", "nom"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="prenom">Prenom:</label></td>
<td><input type="text" name="prenom" id="prenom" value="<?php echo KT_escapeAttribute($row_rscustom['prenom']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("prenom");?> <?php echo $tNGs->displayFieldError("custom", "prenom"); ?> </td>
</tr>
<tr class="KT_buttons">
<td colspan="2"><input type="submit" name="KT_Custom1" id="KT_Custom1" value="Envoyer" />
</td>
</tr>
</table>
</form>
<p> </p>
</p>
<div align="center"><br>
<br>
<a href="panier4_1.php">Retour à la Boutique</a>
</div>
<p> </p>
</div>
<p align="right"> </p>
<p align="right"> </p>
</div>
<div align="right"><a href="http://www.nopixel.ch" target="_blank"></a></div>
<div align="right"><a href="http://www.nopixel.ch" target="_blank">NoPixel</a></div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>