Problème Php : Undifined Index ..
Posté : 01 juil. 2015, 07:38
Bonjour les amis :
Je suis encore débutant en PHP et je travail sur la conception d'un site internet E-commerce ..pour un projet de fin d'études
J'ai un problème avec la tva ( elle se calcule est s'affiche correctement sur la bd lorsque je rentre un article comme Admin ) mais lorsque j'ajoute un article au panier ça s'affiche pas
Notice: Undefined index: tva in C:\wamp\www\Site e-Commerce\include\fonctions_panier.php on line 159
153 function montantGlobaltva(){
154 $total = 0;
155 for($i = 0; $i < count($_SESSION['panier']['titreProduit']); $i++)
156 {
157 $total += $_SESSION['panier']['QteArticle'][$i] * $_SESSION['panier']['prixProduit'][$i];
158 }
159 return $total + $total*$_SESSION['panier']['tva']/100;
160 }
Notice: Undefined index: tva in C:\wamp\www\Site e-Commerce\panier.php on line 160
154 for($i = 0; $i<$nbproduits; $i++){
155 ?>
156 <tr>
157 <td></br><?php echo $_SESSION['panier']['titreProduit'][$i]; ?></td>
158 <td></br><?php echo $_SESSION['panier']['prixProduit'][$i]; ?></td>
159<td></br><input name="q[]" value="<?php echo $_SESSION['panier']['QteArticle'][$i] ?>" size="5"/></td>
160<td></br><?php echo $_SESSION['panier']['tva']." %"; ?></td>
161<td></br><a href="panier.php?action=suppression&l=<?php echo
rawurlencode($_SESSION['panier']['titreProduit'][$i]); ?>">X</a></td>
162 </tr>
163 <?php } ?>
164 <tr>
Est Lorsque je vide le panier :
Fatal error: in C:\wamp\www\Site e-Commerce\include\fonctions_panier.php on line 30
( ! ) PDOException: in C:\wamp\www\Site e-Commerce\include\fonctions_panier.php on line 30
24 if(!isset($_SESSION['panier'])){
25 $_SESSION['panier'] = array();
26 $_SESSION['panier']['titreProduit'] = array();
27 $_SESSION['panier']['QteArticle'] = array();
28 $_SESSION['panier']['prixProduit'] = array();
29 $_SESSION['panier']['verrou'] = false;
30 $select = $db->query("SELECT tva FROM produit");
31 $data = $select->fetch(PDO::FETCH_OBJ);
32 $_SESSION['panier']['tva'] = $data->tva;
33 }
34 return true;
35 }
Je suis encore débutant en PHP et je travail sur la conception d'un site internet E-commerce ..pour un projet de fin d'études
J'ai un problème avec la tva ( elle se calcule est s'affiche correctement sur la bd lorsque je rentre un article comme Admin ) mais lorsque j'ajoute un article au panier ça s'affiche pas
Notice: Undefined index: tva in C:\wamp\www\Site e-Commerce\include\fonctions_panier.php on line 159
153 function montantGlobaltva(){
154 $total = 0;
155 for($i = 0; $i < count($_SESSION['panier']['titreProduit']); $i++)
156 {
157 $total += $_SESSION['panier']['QteArticle'][$i] * $_SESSION['panier']['prixProduit'][$i];
158 }
159 return $total + $total*$_SESSION['panier']['tva']/100;
160 }
Notice: Undefined index: tva in C:\wamp\www\Site e-Commerce\panier.php on line 160
154 for($i = 0; $i<$nbproduits; $i++){
155 ?>
156 <tr>
157 <td></br><?php echo $_SESSION['panier']['titreProduit'][$i]; ?></td>
158 <td></br><?php echo $_SESSION['panier']['prixProduit'][$i]; ?></td>
159<td></br><input name="q[]" value="<?php echo $_SESSION['panier']['QteArticle'][$i] ?>" size="5"/></td>
160<td></br><?php echo $_SESSION['panier']['tva']." %"; ?></td>
161<td></br><a href="panier.php?action=suppression&l=<?php echo
rawurlencode($_SESSION['panier']['titreProduit'][$i]); ?>">X</a></td>
162 </tr>
163 <?php } ?>
164 <tr>
Est Lorsque je vide le panier :
Fatal error: in C:\wamp\www\Site e-Commerce\include\fonctions_panier.php on line 30
( ! ) PDOException: in C:\wamp\www\Site e-Commerce\include\fonctions_panier.php on line 30
24 if(!isset($_SESSION['panier'])){
25 $_SESSION['panier'] = array();
26 $_SESSION['panier']['titreProduit'] = array();
27 $_SESSION['panier']['QteArticle'] = array();
28 $_SESSION['panier']['prixProduit'] = array();
29 $_SESSION['panier']['verrou'] = false;
30 $select = $db->query("SELECT tva FROM produit");
31 $data = $select->fetch(PDO::FETCH_OBJ);
32 $_SESSION['panier']['tva'] = $data->tva;
33 }
34 return true;
35 }