1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| <?php
session_start ();
require('_connexion.php');
if (isset($_SESSION['nom'])) {
if ($_POST['qte'])
{foreach( $_POST['qte'] as $Id_prod => $quantite )
{
if($quantite) {
$prod = 'SELECT * FROM produits WHERE id_produits="'.$Id_prod.'"';
$pr = mysql_query($prod) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$data = mysql_fetch_array($pr);
$id_produits=$data['id_produits'];
$famille=$data['famille'];
$produit=$data['titre'];
$code=$data['code'];
$reduction=$data['reduction'];
$puht=$data['puht'];
$puhtreduit=$data['puhtreduit'];
$tva=$data['tva'];
$puttc=$data['puttc'];
$masse=$data['masse'];
$conditionnement=$data['conditionnement'];
$dispo=$data['dispo'];
$unite=$data['unite'];
$nom=$_SESSION['nom'];
$email=$_SESSION['email'];
$tel=$_SESSION['tel'];
$enregistrement = "INSERT INTO enregistrement VALUES ('', '$famille', '$nom', '$tel', '$email', '$produit', '$code', '$conditionnement', '$masse', '$puht', '$reduction', '$puhtreduit', '$tva','$puttc','$id_produits' , '$quantite', '$dispo', '$unite')";
mysql_query($enregistrement);
}
else {}
}
}
else {}
}
else{echo '<body onLoad="alert(\'Membre non reconnu, merci de vous inscrire et/ou de vous identifier avant de faire votre commande\')">';
// puis on le redirige vers la page d'accueil
echo '<meta http-equiv="refresh" content="0;URL=index.php">';}
?>
<br />
<h3><center>Entrer les quantités pour chaque produit puis en fin de commande cliquer sur "Enregistrer la commande" <br />Le récapitulatif de votre commande se trouve dans votre panier.<br />
Vous pourrez modifier les quantités de votre commande ou supprimer des produits directement dans votre panier.</center></h3>
<br />
<br>
<h3><form method="post" action="index.php?page=commande">
<input type="submit" value="Enregistrer la commande" style="width:250px" name="Envoyer"></h3>
<br />
<table border="1" width=100%>
<FONT size="15pt">
<tr><td><center>Familles</center></td>
<td><center>Produits</center></td>
<td><center>référence</center></td>
<td><center>Conditionnement</center></td>
<td><center>Prix TTC</center></td>
<td><center>Quantité souhaitée!!</center>
</tr></FONT>
<tbody>
<?php
while($row = mysql_fetch_assoc($produits)) {
if ($row['famille']=="A-PUREE")
{$couleur=FFEC33;}
if ($row['famille']=="B-PUREE SUCREES")
{$couleur=D19E14;}
if ($row['famille']=="J-PRODUITS SUCRANTS")
{$couleur=A6D114;}
if ($row['famille']=="D-PATES D'AMANDE")
{$couleur=C1F1E5;}
if ($row['famille']=="E-PATES A TARTINER")
{$couleur=EFDBF8;}
if ($row['famille']=="F-GOMA-SIO")
{$couleur=F8CCF3;}
if ($row['famille']=="H-FRUITS SECS APERITIFS")
{$couleur=F8E2AB;}
if ($row['famille']=="G-FRUITS SECS")
{$couleur=DCD9D0;}
if ($row['famille']=="E-BOISSONS EN POUDRE")
{$couleur=EAF5A9;}
if ($row['famille']=="K-AUTRES")
{$couleur=D8C3F6;}
if ($row['famille']=="I-AIDES CULINAIRES")
{$couleur=F5D3E2;}
if ($row['dispo']=="0")
{$couleur=A4A4A4;}
if ($row['dispo']=="0")
{$com_dispo="Non disponible";}
else {$com_dispo="";}
$prix_ttc=round ($row['puht']*(1-($row['reduction']/100))*(1+($row['tva']/100))*$row['unite'],2);
?>
<tr><td width=15% bgcolor="<?php echo $couleur; ?>"><?php echo $row['famille']; ?></td>
<td width=60% bgcolor="<?php echo $couleur; ?>"><?php echo $row['titre']; ?></td>
<td width=10% bgcolor="<?php echo $couleur; ?>"><?php echo $row['code']; ?> </td>
<td width=10% bgcolor="<?php echo $couleur; ?>"><?php echo $row['conditionnement']; ?></td>
<td width=5% bgcolor="<?php echo $couleur; ?>"><?php echo $prix_ttc; ?></td>
<td width=5%><?php echo $com_dispo; ?><input type="text" name="qte[<?php echo $row['id_produits']; ?>]" value="">
</tr>
<?php } ?>
</tbody>
</table>
<br>
<br>
<h3><form method="post" action="index.php?page=commande">
<input type="submit" value="Enregistrer la commande" style="width:250px" name="Envoyer"></h3></form>
<br /><br />
</div> |
Partager