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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
| <?
session_start();
if (isset($_SESSION["caddie"]))
{
$caddie = $_SESSION["caddie"];
}
else
{
$caddie = array();
}
if (isset($sup))
{
unset($caddie["$sup"]);
}
if (isset($lettre))
{
$sizel = $lettre;
}
if (empty($_POST['pnum']))
{
$quantite=1;
}
else
{
$quantite=$_POST['pnum'];
}
$caddie[$article]=$caddie[$article]+$quantite;
$i=0;
if (isset($nombre[$i]))
{
$a=count($_SESSION["caddie"]);
$a--;
for ($j=0;$j<$a;$j++)
{
if ((ereg("^([0-9]+)$",$nombre[$j])) && $nombre[$j]!="0")
{
$caddie["$produit[$j]"]=$nombre[$j];
}
}
}
include("design/headeri.php");
require("config.php");
$_SESSION["caddie"] = $caddie;
echo"<td bgcolor=\"$barre1\"><a href=\"index.php\"><font size=\"2px\"<strong>Accueil</a> > <a href=\"liste.php?cat=1\">Homme</a> > Panier </strong></font><br><br><br></td>
</tr>
<tr><br>";
echo"<br><center><table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"$bordercolor\">
<tr>
<td><div align=\"center\"><table width=\"70%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"$barre1\">
<tr>
<td width=\"30%\"><div align=\"center\"><strong><font color=\"$police3\" size=\"$width_police2\">Designation</font></strong></div></td>
<td width=\"10%\"><div align=\"center\"><strong><font color=\"$police3\" size=\"$width_police2\">Taille</font></strong></div></td>
<td width=\"10%\"><div align=\"center\"><strong><font color=\"$police3\" size=\"$width_police2\">Prix unitaire</font></strong></div></td>
<td width=\"5%\"><div align=\"center\"><strong><font color=\"$police3\" size=\"$width_police2\">Quantité</font></strong></div></td>
<td width=\"10%\"><div align=\"center\"><strong><font color=\"$police3\" size=\"$width_police2\">Prix total</font></strong></div></td>
<td width=\"5%\"><div align=\"center\"><strong><font color=\"$police3\" size=\"$width_police2\">Supprimer</font></strong></div></td>
</tr>";
while($var = each($caddie))
{
$sql = "SELECT id_pro,titre_prod,pxht_prod,promo_prod,pxhtpromo_prod FROM $table_produit where id_pro='$var[0]'";
$sql = mysql_db_query($base,$sql);
while ($site=mysql_fetch_array($sql))
{
if (empty($nombre[$i]) || !(ereg("^([0-9]+)$",$nombre[$j])) || $nombre[$j]=="0")
{
$nombre[$i]="$var[1]";
}
else
{
$var[1]=$nombre[$i];
}
if ($site[promo_prod]=="1")
{
$site[pxht_prod]=$site[pxhtpromo_prod];
}
$pxtotal=$site[pxht_prod]*$var[1];
$total=$total+($site[pxht_prod]*$var[1]);
echo"<tr bgcolor=\"$barre3\">
<td><div align=\"center\">$site[titre_prod]</div></td>
<td><div align=\"center\">$silzel</div></td>
<td><div align=\"center\">$site[pxht_prod] </div></td>
<td><div align=\"center\"><form action=\"panier.php\" method=\"post\" style='margin-top: 0px; margin-bottom: 0px'><input name=\"produit[$i]\" type=\"hidden\" value=\"$var[0]\"><input name=\"nombre[$i]\" type=\"text\" value=\"$nombre[$i]\" size=\"2\"></div><br></td>
<td><div align=\"center\">$pxtotal </div></td>
<td><div align=\"center\"><a href=\"panier.php?sup=$site[id_pro]\"><img src=\"design/suprimmer.gif\" border=\"0\"onclick=\"javascript:if(!confirm('Etes-vous sûr de vouloir supprimer cet article de votre panier?')) return false;\" ></a></div></td>
</tr>";
$i++;
$test="1";
}
}
if ($test=="1")
{
echo"<tr bgcolor=\"$barre3\">
<td> </td>
<td> </td>
<td><div align=\"center\"><input type=\"image\" src=\"design/recalculer.gif\" border=0></td>
<td><div align=\"center\"><strong>Total</strong></div></td>
<td><div align=\"center\"><strong>$total </strong></div></td>
<td></form></td>
</tr>";
}
echo"</div></table></td>
</tr>
</table></center><br><br>";
if ($test=="1")
{
echo"<center><table border=\"0\" cellpadding=10>
<tr>
<td><a href=\"index.php\"><img src=\"design/poursuis.gif\" border=\"0\"></a></td>
<td><form action=\"compte.php\" method=\"post\" style='margin-top: 0px; margin-bottom: 0px'>
<input name=\"achat\" type=\"hidden\" value=\"autorisation\">
<input type=\"image\" src=\"design/commande.gif\">
</form></td>
</tr>
</table></center><br><br>";
}
else
{
session_unregister("achat");
echo"<center><strong>votre panier est vide</strong><br><br><a href=\"liste.php?cat=1\"><img src=\"design/retour.gif\" border=\"0\"></a><br><br></center>";
}
include("design/footer.php");
?> |
Partager