Exemplo n.º 1
0
 public function verification_lignes(Panier $monpanier)
 {
     $requete = $this->_db->prepare('select * from panier where idart=:idart and idutil=:idutil');
     $requete->execute(array(':idart' => $monpanier->getIdart(), ':idutil' => $_SESSION['id']));
     $results = $requete->fetchAll();
     $tabobject = array();
     if (empty($results)) {
         return false;
     } else {
         foreach ($results as $result) {
             $monnouveaupanier = new Panier();
             $monnouveaupanier->setIdpanier($result['id'])->setIdutil($result['idutil'])->setIdart($result['idart'])->setNomart($result['nomart'])->setDescriptionart($result['descriptionart'])->setPointsart($result['pointsart'])->setQuantiteart($result['quantiteart'])->setImgart($result['imgart']);
             array_push($tabobject, $monnouveaupanier);
             // Push l'objet $article dans le tableau $tabobject
         }
     }
     return $tabobject;
 }
Exemplo n.º 2
0
<?php

/**
 * Created by PhpStorm.
 * User: Florent
 * Date: 12/03/2015
 * Time: 08:48
 */
require_once '../bdd/pdo.php';
require_once '../manager/PanierManager.php';
require_once '../class/Panier.php';
session_start();
$monpanier = new Panier();
$monpaniermanager = new PanierManager($bdd);
$monpanier->setIdpanier($_POST['idpanier']);
$monpaniermanager->suppression_panier_ligne($monpanier);
if ($monpaniermanager->verification_suppression($monpanier) == true) {
    header('Location:../main/panier.php');
} else {
    echo "Erreur l'article n'est pas supprimé";
}
Exemplo n.º 3
0
<?php

/**
 * Created by PhpStorm.
 * User: Florent
 * Date: 12/03/2015
 * Time: 08:48
 */
require_once '../bdd/pdo.php';
require_once '../class/Article.php';
require_once '../manager/ArticleManager.php';
require_once '../manager/PanierManager.php';
require_once '../class/Panier.php';
session_start();
$monpanier = new Panier();
$monpaniermanager = new PanierManager($bdd);
$id = $_POST['idpanier1'];
$quantite = $_POST['quantitepanier'];
$monpanier->setIdpanier($id);
$monpanier->setQuantiteart($quantite);
if ($monpanier->getQuantiteart() == 1) {
    $monpaniermanager->suppression_panier_ligne($monpanier);
    header('Location:../main/panier.php');
} else {
    $monpaniermanager->soustraction_un($monpanier);
    header('Location:../main/panier.php');
}