Boujour! j'ai un petit soucis et j'ai besoin de votre aide...
Lorsque je clique sur le bouton "Ajouter au panier", je reçois un affichage suivant :
Notice: Undefined index: product in C:\xampp\htdocs\ProjetEcom\nzandoEcom\product.php on line 6
Voici mon code PHP
<?php include 'includes/session.php'; ?>
<?php
$conn = $pdo->open();
$slug = $_GET['product'];
try{
$stmt = $conn->prepare("SELECT *, produit.designation AS prodname, categorie.libelleCategorie AS catname, produit.idProduit AS prodid FROM produit LEFT JOIN categorie ON categorie.idCategorie=produit.idCategorie WHERE designation=:designation");
$stmt->execute(['designation' => $slug]);
$product = $stmt->fetch();
}
catch(PDOException $e){
echo "Probleme de connexion: " . $e->getMessage();
}
//page view
//$now = date('d-m-Y');
//if($product['dateVue'] == $now){
// $stmt = $conn->prepare("UPDATE produit SET counter=counter+1 WHERE idProduit=:idProduit");
// $stmt->execute(['idProduit'=>$product['prodid']]);
//}
//else{
// $stmt = $conn->prepare("UPDATE produit SET counter=1, dateVue=:now WHERE idProduit=:idProduit");
// $stmt->execute(['idProduit'=>$product['prodid'], 'now'=>$now]);
//}
?>
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Details produit</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="assets/images/favicon.ico">
<!-- CSS
============================================ -->
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<!-- Icon Font CSS -->
<link rel="stylesheet" href="assets/css/icon-font.min.css">
<!-- Plugins CSS -->
<link rel="stylesheet" href="assets/css/plugins.css">
<!-- Main Style CSS -->
<link rel="stylesheet" href="assets/css/style.css">
<!-- Modernizer JS -->
<script src="assets/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.12';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- Header Section Start -->
<div class="header-section section">
<!-- Header Top Start -->
<div class="header-top header-top-one header-top-border pt-10 pb-10">
<div class="container">
<div class="row align-items-center justify-content-between">
<div class="col mt-10 mb-10">
<!-- Header Links Start -->
<div class="header-links">
<a href="track-order.php"><img src="assets/images/icons/car.png" alt="Car Icon"> <span>Pister votre commande</span></a>
<a href="store.php"><img src="assets/images/icons/marker.png" alt="Car Icon"> <span>Localiser</span></a>
</div><!-- Header Links End -->
</div>
<div class="col order-12 order-xs-12 order-lg-2 mt-10 mb-10">
<!-- Header Advance Search Start -->
<div class="header-advance-search">
<form action="#">
<div class="input"><input type="text" placeholder="Rechercher "></div>
<div class="select">
<select class="nice-select">
<option>Toutes categories</option>
<option>Mobile</option>
<option>Ordinateur</option>
<option>Laptop</option>
<option>Camera</option>
</select>
</div>
<div class="submit"><button><i class="icofont icofont-search-alt-1"></i></button></div>
</form>
</div><!-- Header Advance Search End -->
</div>
<div class="col order-2 order-xs-2 order-lg-12 mt-10 mb-10">
<ul>
<?php
/* connexion utilisateur ou affichage de deux boutons se connecter et s'inscrire */
if(isset($_SESSION['user'])){
$image = (!empty($user['imageUtilisateur'])) ? 'images/'.$user['imageUtilisateur'] : 'images/profile.jpg';
echo '
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="'.$image.'" class="img-circle" alt="User Image" width="30" height="30">
<span class="hidden-xs">'.$user['prenom'].' '.$user['nom'].'</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<center><img src="'.$image.'" class="img-circle" alt="User Image" width="50" height="50" ></center>
<p><center> '.$user['prenom'].' '.$user['nom'].' </center><br/>
<center> <small>Membre depuis '.date('M. Y', strtotime($user['dateMembre'])).'</small></center>
</p>
</li>
<li class="user-footer">
<div class="pull-left">
<a href="profile.php" class="btn btn-default btn-flat">Voir Profile</a>
</div>
<div class="pull-right">
<a href="logout.php" class="btn btn-default btn-flat">Déconnexion</a>
</div>
</li>
</ul>
</li>
';
}
else{
echo "
<!-- Header Account Links Start -->
<div class='header-account-links'>
<a href='login.php'><i class='icofont icofont-login d-none'></i><span>S'identifier</span></a>
<a href='signup.php'><i class='icofont icofont-login d-none'></i> <span>S'enregistrer</span></a>
</div><!-- Header Account Links End -->
";
}
?>
</ul>
</div>
</div>
</div>
</div><!-- Header Top End -->
<!-- Header Bottom Start -->
<div class="header-bottom header-bottom-one header-sticky">
<div class="container">
<div class="row align-items-center justify-content-between">
<div class="col mt-15 mb-15">
<!-- Logo Start -->
<div class="header-logo">
<a href="index.html">
<img src="assets/images/.png" alt="logo magasin">
<img class="theme-dark" src="assets/images/.png" alt="">
</a>
</div><!-- Logo End -->
</div>
<div class="col order-12 order-lg-2 order-xl-2 d-none d-lg-block">
<!-- Main Menu Start -->
<div class="main-menu">
<nav>
<ul>
<li class="active"><a href="index.php">Acceuil</a></li>
<li class="menu-item-has-children"><a href="shop-grid.php"> Boutiques</a>
<ul class="sub-menu">
<li class="menu-item-has-children"><a href="shop-grid.html">CATEGORIE 1</a></li>
<li class="menu-item-has-children"><a href="single-product.html">CATEGORIE 2</a></li>
<li class="menu-item-has-children"><a href="single-product.html">CATEGORIE 3</a></li>
<li class="menu-item-has-children"><a href="single-product.html">BOUTIQUE 4</a></li>
</ul>
</li>
<li class="menu-item-has-children"><a href="#">PAGES</a>
<ul class="mega-menu three-column">
<li><a href="#">Column One</a>
<ul>
<li><a href="about-us.html">About us</a></li>
<li><a href="best-deals.html">Best Deals</a></li>
<li><a href="cart_view.php">Voir panier</a></li>
<li><a href="checkout.html">Checkout</a></li>
</ul>
</li>
<li><a href="#">Column Two</a>
<ul>
<li><a href="compare.html">Compare</a></li>
<li><a href="faq.html">Faq</a></li>
<li><a href="feature.html">Feature</a></li>
<li><a href="login.html">Login</a></li>
<li><a href="register.html">Register</a></li>
<li><a href="store.html">Store</a></li>
</ul>
</li>
<li><a href="#">Column Three</a>
<ul>
<li><a href="terms-conditions.html">Terms & Conditions</a></li>
<li><a href="track-order.html">Track Order</a></li>
<li><a href="wishlist.html">Wishlist</a></li>
</ul>
</li>
</ul>
</li>
<li class="menu-item-has-children"><a href="blog-1-column-left-sidebar.html">BLOG</a>
<ul class="sub-menu">
<li><a href="blog-1-column-left-sidebar.html">Blog 1 Column Left Sidebar</a></li>
<li><a href="single-blog-left-sidebar.html">Single Blog Left Sidebar</a></li>
</ul>
</li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
</nav>
</div><!-- Main Menu End -->
</div>
<div class="col order-2 order-lg-12 order-xl-12">
<!-- Header Shop Links Start -->
<div class="header-shop-links">
<!-- Compare -->
<a href="compare.html" class="header-compare"><i class="ti-control-shuffle"></i></a>
<!-- Wishlist -->
<a href="wishlist.html" class="header-wishlist"><i class="ti-heart"></i> <span class="number">3</span></a>
<!-- Cart -->
<a href="cart.html" class="header-cart"><i class="ti-shopping-cart"></i> <span class="number"></span></a>
</div><!-- Header Shop Links End -->
</div>
<!-- Mobile Menu -->
<div class="mobile-menu order-12 d-block d-lg-none col"></div>
</div>
</div>
</div><!-- Header Bottom End -->
</div><!-- Header Section End -->
<!-- Mini Cart Wrap Start -->
<div class="mini-cart-wrap">
<!-- Mini Cart Top -->
<div class="mini-cart-top">
<button class="close-cart">Fermer<i class="icofont icofont-close"></i></button>
</div>
<!-- Mini Cart Products -->
<ul class="mini-cart-products">
</ul>
<!-- Mini Cart Bottom -->
<div class="mini-cart-bottom">
<h4 class="sub-total">Total: <span>1160 Fcfa</span></h4>
<div class="button">
<a href="checkout.html">Passer a la caisse</a>
</div>
</div>
</div><!-- Mini Cart Wrap End -->
<!-- Cart Overlay -->
<div class="cart-overlay"></div>
<!-- Page Banner Section Start -->
<div class="page-banner-section section">
<div class="page-banner-wrap row row-0 d-flex align-items-center ">
<!-- Page Banner -->
<div class="col-lg-4 col-12 order-lg-2 d-flex align-items-center justify-content-center">
<div class="page-banner">
<h1>Details produit</h1>
<p>similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita</p>
<div class="breadcrumb">
<ul>
<li><a href="index.php">Acceuil</a></li>
<?php echo "<li><a href='product.php?product=".$product['designation']."'>".$product['designation']."</a></li>"; ?>
</ul>
</div>
</div>
</div>
<!-- Banner -->
<div class="col-lg-4 col-md-6 col-12 order-lg-1">
<div class="banner"><a href="#"><img src="assets/images/banner/banner-15.jpg" alt="Banner"></a></div>
</div>
<!-- Banner -->
<div class="col-lg-4 col-md-6 col-12 order-lg-3">
<div class="banner"><a href="#"><img src="assets/images/banner/banner-14.jpg" alt="Banner"></a></div>
</div>
</div>
</div><!-- Page Banner Section End -->
<!-- Single Product Section Start -->
<div class="product-section section mt-90 mb-90">
<div class="container">
<div class="row mb-90">
<div class="col-lg-6 col-12 mb-50">
<!-- Image -->
<div class="single-product-image thumb-right">
<div class="tab-content">
<div id="single-image-1" class="tab-pane fade show active big-image-slider">
<div class="big-image"><img src="<?php echo (!empty($product['imageProduit'])) ? 'images/'.$product['imageProduit'] : ''; ?>" alt="Big Image"><a href="<?php echo (!empty($product['imageProduit'])) ? 'images/'.$product['imageProduit'] : ''; ?>" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div>
<!--div class="big-image"><img src="assets/images/single-product/big-2.png" alt="Big Image"><a href="assets/images/single-product/big-2.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div-->
<!--div class="big-image"><img src="assets/images/single-product/big-3.png" alt="Big Image"><a href="assets/images/single-product/big-3.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div-->
</div>
<!--div id="single-image-2" class="tab-pane fade big-image-slider">
<div class="big-image"><img src="assets/images/single-product/big-7.png" alt="Big Image"><a href="assets/images/single-product/big-7.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div>
<div class="big-image"><img src="assets/images/single-product/big-8.png" alt="Big Image"><a href="assets/images/single-product/big-9.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div>
<div class="big-image"><img src="assets/images/single-product/big-9.png" alt="Big Image"><a href="assets/images/single-product/big-9.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div>
</div-->
<!--div id="single-image-3" class="tab-pane fade big-image-slider">
<div class="big-image"><img src="assets/images/single-product/big-13.png" alt="Big Image"><a href="assets/images/single-product/big-13.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div>
<div class="big-image"><img src="assets/images/single-product/big-14.png" alt="Big Image"><a href="assets/images/single-product/big-14.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div>
<div class="big-image"><img src="assets/images/single-product/big-15.png" alt="Big Image"><a href="assets/images/single-product/big-15.png" class="big-image-popup"><i class="fa fa-search-plus"></i></a></div>
</div-->
</div>
<!--div class="thumb-image-slider nav" data-vertical="true">
<a class="thumb-image active" data-toggle="tab" href="#single-image-1"><img src="assets/images/single-product/thumb-1.png" alt="Thumbnail Image"></a>
<a class="thumb-image" data-toggle="tab" href="#single-image-2"><img src="assets/images/single-product/thumb-2.png" alt="Thumbnail Image"></a>
<a class="thumb-image" data-toggle="tab" href="#single-image-3"><img src="assets/images/single-product/thumb-3.png" alt="Thumbnail Image"></a>
</div-->
</div>
</div>
<div class="callout" id="callout" style="display:none">
<button type="button" class="close"><span aria-hidden="true">×</span></button>
<span class="message"></span>
</div>
<div class="col-lg-6 col-12 mb-50">
<!-- Content -->
<div class="single-product-content">
<!-- Category & Title -->
<div class="head-content">
<div class="category-title">
<a href="category.php?category=<?php echo $product['libelleCategorie']; ?>" class="cat"><?php echo $product['catname']; ?></a>
<h5 class="title"><?php echo $product['prodname']; ?></h5>
</div>
<h5 class="price"><?php echo number_format($product['prixProduit'], 2); ?> FCFA</h5>
</div>
<div class="single-product-description">
<div class="ratting">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-o"></i>
</div>
<div class="desc">
<p><?php echo $product['description']; ?></p>
</div>
<span class="availability">Disponible: <span>en stock</span></span>
<form id="productForm">
<div class="quantity-colors">
<div class="quantity">
<h5>Quantite</h5>
<div class="pro-qty"><input type="number" name="quantiteProduit" value="1"></div>
<div class="pro-pdt"><input type="hidden" name="idProduit" value="<?php echo $product['prodid']; ?>" ></div>
</div>
<div class="colors">
<h5>Couleur</h5>
<select class="nice-select">
<option>rouge</option>
<option>noir</option>
<option>jaune</option>
<option>gris</option>
</select>
</div>
</div>
<div class="actions">
<!--a href="#" class="add-to-cart" ><i class="ti-shopping-cart"></i><span>Ajouter au panier</span></a-->
<button type="submit" class="btn btn-primary btn-lg btn-flat"><i class="fa fa-shopping-cart"></i> Ajouter au panier</button>
<div class="wishlist-compare">
<a href="#" data-tooltip="Comparer"><i class="ti-control-shuffle"></i></a>
<a href="#" data-tooltip="liste souhait"><i class="ti-heart"></i></a>
</div>
</div>
</form>
<div class="tags">
<h5>Marques:</h5>
<a href="#">Electronique</a>
<a href="#">Smartphone</a>
<a href="#">Phone</a>
<a href="#">Chargeur</a>
<a href="#">Powerbank</a>
</div>
<div class="share">
<h5>Partager: </h5>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-instagram"></i></a>
<a href="#"><i class="fa fa-google-plus"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- Single Product Section End -->
<!-- Related Product Section Start -->
<div class="product-section section mb-70">
<div class="container">
<div class="row">
<!-- Section Title Start -->
<div class="col-12 mb-40">
<div class="section-title-one" data-title="PRODUITS APPARENTES"><h1>PRODUITS APPARENTES</h1></div>
</div><!-- Section Title End -->
<!-- Product Tab Content Start -->
<div class="col-12">
<!-- Product Slider Wrap Start -->
<div class="product-slider-wrap product-slider-arrow-one">
<!-- Product Slider Start -->
<div class="product-slider product-slider-4">
<div class="col pb-20 pt-10">
<!-- Product Start -->
<div class="ee-product">
<!-- Image -->
<div class="image">
<a href="single-product.html" class="img"><img src="assets/images/product/product-1.png" alt="Product Image"></a>
<div class="wishlist-compare">
<a href="#" data-tooltip="Comparer"><i class="ti-control-shuffle"></i></a>
<a href="#" data-tooltip="liste souhaits"><i class="ti-heart"></i></a>
</div>
<a href="#" class="add-to-cart" id="productForm"><i class="ti-shopping-cart"></i><span>Ajouter au panier</span></a>
</div>
<!-- Content -->
<div class="content">
<!-- Category & Title -->
<div class="category-title">
<a href="#" class="cat">Laptop</a>
<h5 class="title"><a href="single-product.html">Zeon Zen 4 Pro</a></h5>
</div>
<!-- Price & Ratting -->
<div class="price-ratting">
<h5 class="price">295000.00 Fcfa</h5>
<div class="ratting">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half-o"></i>
<i class="fa fa-star-o"></i>
</div>
</div>
</div>
</div><!-- Product End -->
</div>
<div class="col pb-20 pt-10">
<!-- Product Start -->
<div class="ee-product">
<!-- Image -->
<div class="image">
<span class="label sale">En vente</span>
<a href="single-product.html" class="img"><img src="assets/images/product/product-2.png" alt="Product Image"></a>
<div class="wishlist-compare">
<a href="#" data-tooltip="Comparer"><i class="ti-control-shuffle"></i></a>
<a href="#" data-tooltip="liste souhaits"><i class="ti-heart"></i></a>
</div>
<a href="#" class="add-to-cart"><i class="ti-shopping-cart"></i><span>Ajouter au panier</span></a>
</div>
<!-- Content -->
<div class="content">
<!-- Category & Title -->
<div class="category-title">
<a href="#" class="cat">Drone</a>
<h5 class="title"><a href="single-product.html">Aquet Drone D 420</a></h5>
</div>
<!-- Price & Ratting -->
<div class="price-ratting">
<h5 class="price"><span class="old">350000 Fcfa</span>275000.00 Fcfa</h5>
<!--div class="ratting">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half-o"></i>
<i class="fa fa-star-o"></i>
</div-->
</div>
</div>
</div><!-- Product End -->
</div>
<div class="col pb-20 pt-10">
<!-- Product Start -->
<div class="ee-product">
<!-- Image -->
<div class="image">
<a href="single-product.html" class="img"><img src="assets/images/product/product-3.png" alt="Product Image"></a>
<div class="wishlist-compare">
<a href="#" data-tooltip="Comparer"><i class="ti-control-shuffle"></i></a>
<a href="#" data-tooltip="liste souhaits"><i class="ti-heart"></i></a>
</div>
<a href="#" class="add-to-cart"><i class="ti-shopping-cart"></i><span>Ajouter au panier</span></a>
</div>
<!-- Content -->
<div class="content">
<!-- Category & Title -->
<div class="category-title">
<a href="#" class="cat">Jeux</a>
<h5 class="title"><a href="single-product.html">Game Station X 22</a></h5>
</div>
<!-- Price & Ratting -->
<div class="price-ratting">
<h5 class="price">295000.00 Fcfa</h5>
<div class="ratting">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half-o"></i>
</div>
</div>
</div>
</div><!-- Product End -->
</div>
<div class="col pb-20 pt-10">
<!-- Product Start -->
<div class="ee-product">
<!-- Image -->
<div class="image">
<a href="single-product.html" class="img"><img src="assets/images/product/product-4.png" alt="Product Image"></a>
<div class="wishlist-compare">
<a href="#" data-tooltip="Comparer"><i class="ti-control-shuffle"></i></a>
<a href="#" data-tooltip="liste souhaits"><i class="ti-heart"></i></a>
</div>
<a href="#" class="add-to-cart"><i class="ti-shopping-cart"></i><span>Ajouter au panier</span></a>
</div>
<!-- Content -->
<div class="content">
<!-- Category & Title -->
<div class="category-title">
<a href="#" class="cat">Accessoires</a>
<h5 class="title"><a href="single-product.html">Roxxe Headphone Z 75</a></h5>
</div>
<!-- Price & Ratting -->
<div class="price-ratting">
<h5 class="price">110000.00 Fcfa</h5>
<div class="ratting">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
</div>
</div>
</div><!-- Product End -->
</div>
<div class="col pb-20 pt-10">
<!-- Product Start -->
<div class="ee-product">
<!-- Image -->
<div class="image">
<a href="single-product.html" class="img"><img src="assets/images/product/product-5.png" alt="Product Image"></a>
<div class="wishlist-compare">
<a href="#" data-tooltip="Comparer"><i class="ti-control-shuffle"></i></a>
<a href="#" data-tooltip="liste souhaits"><i class="ti-heart"></i></a>
</div>
<a href="#" class="add-to-cart"><i class="ti-shopping-cart"></i><span>Ajouter au panier</span></a>
</div>
<!-- Content -->
<div class="content">
<!-- Category & Title -->
<div class="category-title">
<a href="#" class="cat">Camera</a>
<h5 class="title"><a href="single-product.html">Mony Handycam Z 105</a></h5>
</div>
<!-- Price & Ratting -->
<div class="price-ratting">
<h5 class="price">110000.00 Fcfa</h5>
<div class="ratting">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half-o"></i>
<i class="fa fa-star-o"></i>
</div>
</div>
</div>
</div><!-- Product End -->
</div>
</div><!-- Product Slider End -->
</div><!-- Product Slider Wrap End -->
</div><!-- Product Tab Content End -->
</div>
</div>
</div><!-- Related Product Section End -->
<?php $pdo->close(); ?>
<!-- Brands Section and Subscribe Section Start -->
<?php include 'includes/brandsubslogin.php'; ?>
<!-- Brands Section and Subscribe Section Start -->
<!-- Footer Section Start -->
<?php include 'includes/footer.php'; ?>
<!-- End Footer Section Start -->
<?php include 'includes/scripts.php'; ?>
</body>
</html>
Afficher la suite