Exemplo n.º 1
0
/**
 * 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);
$monpanier->setIdart($_POST['id']);
$monpanier->setNomart($_POST['nom']);
$monpanier->setDescriptionart($_POST['description']);
$monpanier->setPointsart($_POST['points']);
$monpanier->setQuantiteart($_POST['quantite']);
$monpanier->setImgart($_POST['img']);
$monresultats = $monpaniermanager->verification_lignes($monpanier);
if ($monresultats == false) {
    $monpaniermanager->insertion_panier($monpanier);
    header('Location:../main/catalogue.php');
} else {
    foreach ($monresultats as $resultat) {
        $maquantite = $resultat->getQuantiteart() + $monpanier->getQuantiteart();
    }
    $resultat->setQuantiteart($maquantite);
    $monpaniermanager->modification_lignes($resultat);