Bonjour,

J'essaie de faire un site avec l'aide de : eprojet.fr.
J'ai un soucis au niveau du panier, lorsque j'ajoute un produit, cela ne fonctionne pas. Pourtant j'ai bien regardé, ça devrait marcher .

http://beepbeep74.free.fr/grecz/connexion.php

Login : Test1 / Mdp: Test1 => Aller sur la page : La Boutique et essayez d'ajouter un produit.

panier.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
//--- AJOUT PANIER ---//
if(isset($_POST['ajout_panier'])) 
{   // debug($_POST);
    $resultat = executeRequete("SELECT * FROM produit WHERE id='$_POST[id]'");
    $produit = $resultat->fetch_assoc();
    ajouterProduitDansPanier($produit['nom'],$_POST['id'],$_POST['quantite'],$produit['prix']);
}
function
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function ajouterProduitDansPanier($id, $nom, $quantite, $prix)
{
    creationDuPanier(); 
    $position_produit = array_search($id,  $_SESSION['panier']['id']);
    if($position_produit !== false)
    {
         $_SESSION['panier']['quantite'][$position_produit] += $quantite ;
    }
    else
    {
        $_SESSION['panier']['nom'][] = $nom;
        $_SESSION['panier']['id'][] = $id;
        $_SESSION['panier']['quantite'][] = $quantite;
        $_SESSION['panier']['prix'][] = $prix;
    }
}
( A mon avis ca se passe à "where id=..." mais impossible sans s'arracher les cheveux).

Merci de votre aide.