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
|
<?
include ("definitioninfo.php");
include ("aff_panier.inc.php");
if (!session_id())
session_start();
if (!isset($_SESSION['panier'])) //$panier pas defini //sert pour la gestion du panier
{ //ne pas tenir compte pr le moment
$panier = array (
"ref_produit" => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23),
"quantite" => array (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
);
$_SESSION['panier'] = $panier;
$_SESSION['total'] = 0;
}
session_register('article');
session_register('prix');
session_register('quantite');
session_register('ref_produit');
//$_POST['quantite']= $_SESSION['quantite'];
// $_POST['article'] = $_SESSION['article'];
for ($i = 0; $i < 23; $i++) //pr le panier
{
//echo("article : ".$_SESSION['panier']['ref_produit'][$i]);
//echo(" quantite : ".$_SESSION['panier']['quantite'][$i]."<br>");
}
$quantite = $_POST['quantite'];
$article = $_POST['article'];
///echo "quantite post = ".$quantite;
if(!($base=mysql_connect("localhost","root","pouet")))
{
echo "<br><B>probleme lors de la connexion à MySql</B><br>";
exit();
}
else
{
mysql_select_db(BASE, $base);
if (($tab_com = mysql_query("SELECT ref_produit, designation_produit, prix_produit
FROM produit
WHERE designation_produit = '".$article."'", $base)))
$res_com = mysql_fetch_array($tab_com); //tableau contenant les valeurs de la requete (resultat_commande)
}
$_SESSION['article'] = $res_com[1];
$_SESSION['prix'] = $res_com[2];
$_SESSION['quantite'] = $quantite;
$_SESSION['ref_produit']= $res_com[0];
//$_SESSION['panier']['quantite'][$_SESSION['ref_produit']]++; //pr le panier
$_SESSION['panier']['quantite'][$_SESSION['ref_produit']] = $_SESSION['panier']['quantite'][$_SESSION['ref_produit']]+$quantite;
$_SESSION['total'] = $_SESSION['total']+($res_com[2]*$quantite);
//$_SESSION['TTC'] = $_SESSION['total']+ $_SESSION['total']*(19.6/100); // à aligner a droite
echo "<html>
<head>
<title>Bienvenue sur materiel-informatique.fr</title></head>
<body bgcolor=#99ff99 align=right>
<h1 align=\"center\"><font size=+6><font color=\"#000000\"><u>Votre Panier de Commande :</u></font></font></h1>
<br>
<p><form method = \"POST\" action=\"http://127.0.0.1/oceanecoin/SITE%20INFO/ordinateur%20de%20bureau.php\"><input type='submit' value='<<<<<< poursuivre mes achats'></form></p>
<table border=\"1\">
<align=\"center\">
<tr>
<td><b><center>Reference </b></td><br>
<td><b><center>Article</b></td><br>
<td><b><center>Prix Unitaire</b></td>
<td><b><center>Quantité</b></td>
<td><b><center>Montant</b></td>
<td><b><center><img src ='http://xx/yy/SITE%20INFO/corbeille.gif'></td>
</tr>";
//<a href='supprime.php'=$_SESSION['panier']['ref_produit'][$i]>'supprimer'</a>
aff_panier(); //fonction de gestion du panier
/*echo " <tr align=\"center\">
<td><b>".$res_com[1]."</b></td>
<td><b>".$res_com[2]."</b></td>
<td><b>".$quantite."</b></td>
<td><b>".$res_com[2]*$quantite." </b></td>
</tr>";*/
echo "<tr><td></td><td></td><td><b><center>Total : </b></td><td align = \"center\"><b>".$_SESSION['total']."</b></td></tr>";
//echo "<tr><td></td><td></td><td><b><center>TVA : </b></td><td align = \"right\"><b>".$_SESSION['total']*(19.6/100)."</b></td></tr>";
//echo "<tr><td></td><td></td><td><b><h3><center>TOTAL TTC : </b></td><td align = \"right\"><h3><u><b>".$_SESSION['TTC']."</b></td></tr>"; //sert pour le panier
//echo "<tr><td></td><td></td><td><b><u>TOTAL :</u></b></td><td align = \"right\"><b>".$res_com[2]*$quantite." </b></td></tr>
echo "<tr><td></td><td></td><td></td><td colspan='1'><form method = \"POST\" action=\"http://xx/yy/boutiqueinfo/commande2info.php\"><input type='submit' value='Terminer votre Commande'></td></tr>
</table>
</form>
</body>
</html>"
?> |
Partager