Le panier:
<?
$occurence = 0;
$verif_existe = 0;
$nombre_oeuvres = count($_SESSION["tableau_panier"]);
while($occurence < $nombre_oeuvres)
{
$id_oeuvre = $_SESSION["tableau_panier"][$occurence];
if($id_oeuvre!="effacé")
{
$verif_existe = 1;
}
$occurence++;
}
if(isset($_SESSION["tableau_panier"]) AND $_SESSION["occurence_panier"]>0 AND $verif_existe == 1)
{
echo "<table summary=\"Contenu de votre panier\">\n" ;
echo "<tr>\n" ;
echo "<td>\n" ;
echo "Image\n" ;
echo "</td>\n" ;
echo "<td>\n" ;
echo "Opération\n" ;
echo "</td>\n" ;
echo "</tr>" ;
include("connect.php");
//Effacer une oeuvre du panier.
$occurence = 0;
while($occurence < $nombre_oeuvres)
{
$id_oeuvre = $_SESSION["tableau_panier"][$occurence];
if($id_oeuvre!="effacé")
{
$selection_image = "SELECT * FROM mpf_fr_img ";
$selection_image .= "WHERE id_img = $id_oeuvre";
if($ligne_image = mysql_fetch_array(mysql_query($selection_image)))
{
echo "<tr>\n" ;
echo "<td>\n" ;
echo"<img src=\"../images/expo/".$ligne_image["nom_img"]."\
" \nalt=\"".
$ligne_image["nom_oeuvre"]."\" \nclass=\"miniature\" \nid=\"id_".
$ligne_image["nom_img"]."\" \nonclick=\"javascript: ouvrirPopup(".$ligne_image['id_img'].");\" />\n";
echo "</td>\n" ;
echo "<td style=\"text-align: center; padding-top: 20px;\">\n" ;
echo "<input type=\"button\" value=\"Supprimer\" onclick=\"location.href='effacer_oeuvre.php?del_panier=".$id_oeuvre."'
;\" />" ;
echo "</td>\n" ;
echo "</tr>" ;
}
}
$occurence++;
}
if($verif_existe == 1)
{
//Calcul du nombre d'oeuvres dans le panier.
$nombre_occurences = count($_SESSION["tableau_panier"]);
$occurence = 0;
$oeuvres = 0;
while($occurence < $nombre_occurences)
{
if($_SESSION["tableau_panier"]!="effacé")
{
$oeuvres++;
}
$occurence++;
}
echo "\n<tr>\n" ;
echo "<td class=\"commentaire\">\n" ;
echo "<p>Votre panier contient ".$oeuvres." oeuvre(s). Le tarif pour ce nombre d'oeuvres est de :</p>" ;
switch($oeuvres)
{
case $oeuvres >= 30 : $tarif = "<p>x€/pièce par an | x€/pièce pour 6 mois | x€/pièce pour 3mois</p>"; break;
case $oeuvres >= 20 : $tarif = "<p>x€/pièce par an | 9€/pièce pour 6 mois | x€/pièce pour 3mois</p>"; break;
case $oeuvres >= 10 : $tarif = "<p>x€/pièce par an | 12€/pièce pour 6 mois | x€/pièce pour 3mois</p>"; break;
case $oeuvres < 10 : $tarif = "<p>x€/pièce par an | 15€/pièce pour 6 mois | x€/pièce pour 3mois</p>"; break;
}
echo $tarif;
echo "</td>\n" ;
echo "<td>\n" ;
echo "</td>\n" ;
echo "\n" ;
echo "</tr>\n" ;
echo "<tr>\n" ;
echo "<td>\n" ;
echo " \n" ;
echo "</td>\n" ;
echo "<td>\n" ;
echo "<input type=\"button\" value=\"Envoyer la commande\" onclick=\"location.href='envoi_commande.php'\" />\n" ;
echo "</td>\n" ;
echo "\n" ;
echo "</tr>\n" ;
echo "</table>\n" ;
}
}
else
{
echo "<p style=\"font-weight: bold;\">Votre panier est actuellement vide.</p>" ;
}
?>
Merci déja.




Haut











