function getListe( $num_commande=0, $num_produit=0 ) { $commande_produit = new commande_produit(); $requete = "SELECT * FROM commande_produit"; $requete .= " WHERE num_produit > 0"; if ( $num_commande > 0 ) $requete .= " AND num_commande = '" . $num_commande . "'"; if ( $num_produit > 0 ) $requete .= " AND num_produit = '" . $num_produit . "'"; $requete .= " ORDER BY num_commande ASC"; //echo $requete . "<br>"; $liste = mysql_query($requete); // Retourne un tableau $tableau = array(); if (mysql_num_rows($liste) != 0) { $i = 0; while($data = mysql_fetch_assoc($liste)) { //echo "ici : " . $data["num_commande"] . ", " . $data["num_produit"] . "<br>"; // Tentative de chargement du commande if ( $commande_produit->load( $data["num_commande"], $data["num_produit"] ) ) { $tableau[$i] = new commande_produit(); $tableau[$i]->num_commande = $commande_produit->num_commande; $tableau[$i]->num_produit = $commande_produit->num_produit; $tableau[$i]->nom = $commande_produit->nom; $tableau[$i]->quantite = $commande_produit->quantite; $tableau[$i]->prix_unitaire = $commande_produit->prix_unitaire; $i++; } } } return $tableau; }
<? require_once('./classes/config.php'); ?> <? require_once('./classes/classes.php'); ?> <? include('./include_connexion/connexion_site_on.php'); ?> <? require_once('./classes/start_session.php'); ?> <? // Récupération des données passées en paramètres $mon_action = $_POST["mon_action"]; $num_produit = ( $_GET["n"] != "" ) ? $_GET["n"] : $_POST["num_produit"]; $produit = new produit(); $commande = new commande(); $commande_produit = new commande_produit(); /*echo "<pre>"; print_r( $_POST ); echo "</pre>";*/ // Création ou modification de la commande en attente //echo "--- num_client : " . $_SESSION["site"]["num_client"] . "<br>"; if ( ( $_SESSION["site"]["num_client"] != "" ) && ( !$commande->load( $_SESSION["site_num_commande"] ) ) ) { $post["num_etat"] = 2; $post["num_etat_paiement"] = 1; $post["num_client"] = $_SESSION["site"]["num_client"]; $num_commande = $commande->gererDonnees( $post ); //echo "--> num_commande : " . $num_commande . "<br>"; $_SESSION["site_num_commande"] = $num_commande; } /*echo "<pre>"; //print_r( $_SESSION["site_panier"][ $num_produit ] ); //print_r( $_SESSION["site_panier"] );
<? require_once('./classes/config.php'); ?> <? require_once('./classes/classes.php'); ?> <? include('./include_connexion/connexion_site_on.php'); ?> <? require_once('./classes/start_session.php'); ?> <? // Récupération des informations passées en paramètres $num_commande = $_GET["nc"]; //echo "--- mon_action : " . $mon_action . "<br>"; $etat = new etat(); $commande = new commande(); $commande_produit = new commande_produit(); // Chargement de la commande $commande->load( $num_commande ); // Etat de la commande $etat->load( $commande->num_etat ); // Détail du panier $liste = $commande_produit->getListe( $num_commande, 0 ); // Etat du paiement if ( $commande->num_etat_paiement == 0 ) $paiement = "<font color='#CC3300'>Annulé</font>"; else if ( $commande->num_etat_paiement == 1 ) $paiement = "<font color='#EAA327'>En cours</font>"; else $paiement = "<font color='green'>Validé</font>"; ?> <html> <head>