|
Membre régulier
Inscription : février 2003 Messages : 272 Détails du profil  Informations forums : Inscription : février 2003 Messages : 272 Points : 85 Points : 85
|
problème de panier
Bonjour,
Je suis débutant en php et j'ai repris un tutorial php pour faire un panier. voici le tutorial : http://jcrozier.developpez.com/articles/web/panier/
donc j'ai modifié ce code pour faire mon panier perso. tout a l'air de fonctionner tres bien sauf la fonction rafraichir dans le panier
voici les erreurs
Warning: Missing argument 3 for modifierqtearticle() in c:\program files\easyphp1-8\www\foliopub revendeur panier\fonctions-panier.php on line 68
Warning: Missing argument 4 for modifierqtearticle() in c:\program files\easyphp1-8\www\foliopub revendeur panier\fonctions-panier.php on line 68
Warning: Missing argument 5 for modifierqtearticle() in c:\program files\easyphp1-8\www\foliopub revendeur panier\fonctions-panier.php on line 68
Warning: Missing argument 6 for modifierqtearticle() in c:\program files\easyphp1-8\www\foliopub revendeur panier\fonctions-panier.php on line 68
Warning: Missing argument 7 for modifierqtearticle() in c:\program files\easyphp1-8\www\foliopub revendeur panier\fonctions-panier.php on line 68
je vous donne le code des fichiers :
ma page produit
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style-presentation.css" />
<title>Document sans titre</title>
</head>
<body>
<div class="conteneur">
<div class="header">
<img src="images/header.gif" width="970" height="155" alt="Foliopub" />
</div><!-- fin header -->
<div class="leftcol">
<table width="200" border="1">
<tr>
<td> </td>
<td><a href="akylux.php">AKYLUX 600gr/3,5mm</a></td>
</tr>
<tr>
<td> </td>
<td><a href="pvc-2mm.php">PVC 2mm</a></td>
</tr>
<tr>
<td> </td>
<td><a href="pvc-5mm.php">PVC 5mm</a></td>
</tr>
<tr>
<td> </td>
<td><a href="pvc-10mm.php">PVC 10mm</a></td>
</tr>
<tr>
<td> </td>
<td><a href="dibond.php">DIBOND</a></td>
</tr>
<tr>
<td> </td>
<td><a href="plexi-incolore.php">PLEXI INCOLORE 8/10mm</a></td>
</tr>
<tr>
<td> </td>
<td><a href="plexi-diffusant.php">PLEXI BLANC DIFFUSANT 3mm</a></td>
</tr>
<tr>
<td> </td>
<td><a href="bache-promo.php">BACHE 450gr promo courte durée</a></td>
</tr>
<tr>
<td> </td>
<td><a href="bache-b1.php">BACHE 550gr B1</a></td>
</tr>
<tr>
<td> </td>
<td><a href="vinyle-monomere.php">Vinyle Monomère</a></td>
</tr>
<tr>
<td> </td>
<td><a href="vinyle-polymere.php">Vinyle Polymère</a></td>
</tr>
<tr>
<td> </td>
<td><a href="one-way-vision.php">One Way Vision</a></td>
</tr>
<tr>
<td> </td>
<td><a href="magnetique.php">Magnetique</a></td>
</tr>
<tr>
<td> </td>
<td><a href="kit-banderole-60x200.php">Kit Banderole 60x200</a></td>
</tr>
<tr>
<td> </td>
<td><a href="kit-banderole-100x300.php">Kit Banderole 100x300</a></td>
</tr>
<tr>
<td> </td>
<td><a href="enseigne-simple-face.php">Enseigne Lumineuse simple face</a></td>
</tr>
<tr>
<td> </td>
<td><a href="enseigne-double-face.php">Enseigne Lumineuse Double Face</a></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</div><!-- fin leftcol -->
<div class="main">
<?php
if (get_magic_quotes_gpc())
{
$copies=stripslashes($_POST['EditNbreCopies']);
$base=stripslashes($_POST['EditBase']);
$hauteur=stripslashes($_POST['EditHauteur']);
$plastification=stripslashes($_POST['RadioPlastification']);
$decoupe=stripslashes($_POST['RadioDecoupe']);
$definition=stripslashes($_POST['RadioDPI']);
}
else
{
$copies=trim($_POST['EditNbreCopies']);
$base=trim($_POST['EditBase']);
$hauteur=trim($_POST['EditHauteur']);
$plastification=trim($_POST['RadioPlastification']);
$decoupe=trim($_POST['RadioDecoupe']);
$definition=trim($_POST['RadioDPI']);
}
?>
<table border="0" style="border:1px solid #E62018; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;">
<tr>
<td bgcolor="#FF0000" class="style-sous-sous-titres-produits">Dimensions du panneau</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<table border="0">
<tr>
<td width="220" class="style-description-produits">Nombre de copies</td>
<td width="75"> </td>
<td width="75"><input name="EditNbreCopies" type="text" readonly="readonly" value="<?php echo $copies; ?>"/></td>
</tr>
<tr>
<td class="style-description-produits">Dimension de la base (en cm)</td>
<td> </td>
<td><input name="EditBase" type="text" readonly="readonly" value="<?php echo $base; ?>"/></td>
</tr>
<tr>
<td class="style-description-produits">Dimension de la hauteur en cm</td>
<td> </td>
<td><input name="EditHauteur" type="text" readonly="readonly" value="<?php echo $hauteur; ?>"/></td>
</tr>
<tr>
<td class="style-description-produits">Définition</td>
<td> </td>
<td><input name="EditHauteur" type="text" readonly="readonly" value="<?php echo $definition; ?>"/></td>
</tr>
<tr>
<td class="style-description-produits">Plastification</td>
<td> </td>
<td><input name="EditPlastification" type="text" readonly="readonly" value="<?php echo $plastification; ?>"/></td>
</tr>
<tr>
<td class="style-description-produits">Découpe</td>
<td> </td>
<td><input name="EditDecoupe" type="text" readonly="readonly" value="<?php echo $decoupe ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input name="BtnModif" type="button" value="Modifier les données" onclick="history.go(-1)"/></td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<?php
$basediv=$base/100;
$hauteurdiv=$hauteur/100;
$surface=$basediv*$hauteurdiv;
$surfacetotale=$surface*$copies;
if ($definition=='360')
{
$prixakylux=round(($surfacetotale*9.5),2);
}
else if ($definition=='720')
{
$prixakylux=round(($surfacetotale*19.5),2);
}
if ($plastification=='Oui')
{
$prixplastification=round(($surfacetotale*10),2);
}
else if ($plastification=='Non')
{
$prixplastification=0;
}
if ($decoupe=='Oui')
{
$prixdecoupe=round(($surfacetotale*3),2);
}
else if ($decoupe=='Non')
{
$prixdecoupe=0;
}
$prixtotal=round(($prixakylux+$prixplastification+$prixdecoupe),2);
$tva=round((($prixtotal*21)/100),2);
$prixtotalttc=round(($prixtotal+$tva),2);
?>
<table border="0" style="border:1px solid #E62018; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;">
<tr>
<td bgcolor="#FF0000" class="style-sous-sous-titres-produits">Prix de votre commande</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<table border="0">
<tr>
<td width="220" class="style-description-produits">Surface des Akylux commandés</td>
<td width="75"> </td>
<td width="75"><input name="EditPrixAkilux" type="text" readonly="readonly" value="<?php echo $surfacetotale; ?>"/></td>
<td width="150" class="style-description-produits">M²</td>
</tr>
<tr>
<td width="220" class="style-description-produits">Prix des Akylux commandés (9,5 € / M²)</td>
<td width="75"> </td>
<td width="75"><input name="EditPrixAkilux" type="text" readonly="readonly" value="<?php echo $prixakylux; ?>"/></td>
<td width="150" class="style-description-produits">euros</td>
</tr>
<tr>
<td width="220" class="style-description-produits">Prix de la plastification</td>
<td width="75"> </td>
<td width="75"><input name="EditPrixPlastif" type="text" readonly="readonly" value="<?php echo $prixplastification; ?>"/></td>
<td width="150" class="style-description-produits">euros</td>
</tr>
<tr>
<td width="220" class="style-description-produits">Prix de la Découpe</td>
<td width="75"> </td>
<td width="75"><input name="EditPrixDecoupe" type="text" readonly="readonly" value="<?php echo $prixdecoupe; ?>"/></td>
<td width="150" class="style-description-produits">euros</td>
</tr>
<tr>
<td width="220" class="style-description-produits">Prix total des Akilux + plastification + découpe</td>
<td width="75"> </td>
<td width="75"><input name="EditPrixUnit" type="text" readonly="readonly" value="<?php echo $prixtotal; ?>"/></td>
<td width="150" class="style-description-produits">euros</td>
</tr>
<tr>
<td class="style-description-produits" width="250">Prix de la TVA</td>
<td width="20"> </td>
<td width="150"><input name="EditTVA" type="text" readonly="readonly" value="<?php echo $tva; ?>"/></td>
<td class="style-description-produits" width="100">euros</td>
</tr>
<tr>
<td class="style-description-produits" width="250">Prix de vos akylux TTC</td>
<td width="20"> </td>
<td width="150"><input name="EditTotalTTC" type="text" readonly="readonly" value="<?php echo $prixtotalttc; ?>"/></td>
<td class="style-description-produits" width="100">euros</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?php
$libelle='Akylux';
?>
<a href="panier.php?action=ajout&l=<?php echo $libelle; ?>&q=<?php echo $copies; ?>&p=<?php echo $prixakylux; ?>&db=<?php echo $base; ?>&dh=<?php echo $hauteur; ?>&df=<?php echo $definition; ?>&pl=<?php echo $plastification; ?>&dc=<?php echo $decoupe; ?>&" onclick="window.open(this.href, '',
'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=900, height=500'); return false;">Ajouter au panier</a>
</div><!-- fin main -->
</div><!-- fin conteneur -->
</body>
</html> |
ma page panier
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
<?php
session_start();
include_once("fonctions-panier.php");
$erreur = false;
$action = (isset($_POST['action'])? $_POST['action']: (isset($_GET['action'])? $_GET['action']:null )) ;
if($action !== null)
{
if(!in_array($action,array('ajout', 'suppression', 'refresh')))
$erreur=true;
//récuperation des variables en POST ou GET
$l = (isset($_POST['l'])? $_POST['l']: (isset($_GET['l'])? $_GET['l']:null )) ;
$p = (isset($_POST['p'])? $_POST['p']: (isset($_GET['p'])? $_GET['p']:null )) ;
$q = (isset($_POST['q'])? $_POST['q']: (isset($_GET['q'])? $_GET['q']:null )) ;
$db = (isset($_POST['db'])? $_POST['db']: (isset($_GET['db'])? $_GET['db']:null )) ;
$dh = (isset($_POST['dh'])? $_POST['dh']: (isset($_GET['dh'])? $_GET['dh']:null )) ;
$df = (isset($_POST['df'])? $_POST['df']: (isset($_GET['df'])? $_GET['df']:null )) ;
$pl = (isset($_POST['pl'])? $_POST['pl']: (isset($_GET['pl'])? $_GET['pl']:null )) ;
$dc = (isset($_POST['dc'])? $_POST['dc']: (isset($_GET['dc'])? $_GET['dc']:null )) ;
//Suppression des espaces verticaux
$l = preg_replace('#\v#', '',$l);
//On verifie que $p soit un float
$p = floatval($p);
//On traite $q qui peut etre un entier simple ou un tableau d'entier
if (is_array($q)){
$QteArticle = array();
$i=0;
foreach ($q as $contenu){
$QteArticle[$i++] = intval($contenu);
}
}
else
$q = intval($q);
}
if (!$erreur){
switch($action){
Case "ajout":
ajouterArticle($l,$q,$p,$db,$dh,$df,$pl,$dc);
break;
Case "suppression":
supprimerArticle($l);
break;
Case "refresh" :
for ($i = 0 ; $i < count($QteArticle) ; $i++)
{
modifierQTeArticle($_SESSION['panier']['libelleProduit'][$i],round($QteArticle[$i]));
}
break;
Default:
break;
}
}
echo '<?xml version="1.0" encoding="utf-8"?>';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title>Votre panier</title>
</head>
<body>
<form method="post" action="panier.php">
<table style="width: 400px">
<tr>
<td colspan="4">Votre panier</td>
</tr>
<tr>
<td>Libellé</td>
<td>Quantité</td>
<td>Prix Unitaire</td>
<td>Dimension Base</td>
<td>Dimension Hauteur</td>
<td>Définition</td>
<td>Plastification</td>
<td>Découpe</td>
<td>Action</td>
</tr>
<?php
if (creationPanier())
{
$nbArticles=count($_SESSION['panier']['libelleProduit']);
if ($nbArticles <= 0)
echo "<tr><td>Votre panier est vide </ td></tr>";
else
{
for ($i=0 ;$i < $nbArticles ; $i++)
{
echo "<tr>";
echo "<td>".htmlspecialchars($_SESSION['panier']['libelleProduit'][$i])."</ td>";
echo "<td><input type=\"text\" size=\"4\" name=\"q[]\" value=\"".htmlspecialchars($_SESSION['panier']['qteProduit'][$i])."\"/></td>";
echo "<td>".htmlspecialchars($_SESSION['panier']['prixProduit'][$i])."</td>";
echo "<td>".htmlspecialchars($_SESSION['panier']['dimensionBase'][$i])."</td>";
echo "<td>".htmlspecialchars($_SESSION['panier']['dimensionHauteur'][$i])."</td>";
echo "<td>".htmlspecialchars($_SESSION['panier']['choixDefinition'][$i])."</td>";
echo "<td>".htmlspecialchars($_SESSION['panier']['choixPlastification'][$i])."</td>";
echo "<td>".htmlspecialchars($_SESSION['panier']['choixDecoupe'][$i])."</td>";
echo "<td><a href=\"".htmlspecialchars("panier.php?action=suppression&l=".rawurlencode($_SESSION['panier']['libelleProduit'][$i]))."\">XX</a></td>";
echo "</tr>";
}
echo "<tr><td colspan=\"2\"> </td>";
echo "<td colspan=\"2\">";
echo "Total : ".MontantGlobal();
echo "</td></tr>";
echo "<tr><td colspan=\"4\">";
echo "<input type=\"submit\" value=\"Rafraichir\"/>";
echo "<input type=\"hidden\" name=\"action\" value=\"refresh\"/>";
echo "</td></tr>";
}
}
?>
</table>
</form>
</body>
</html> |
et pour finir la page fonctions-panier
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<?php
/**
* Verifie si le panier existe, le créé sinon
* @return booleen
*/
function creationPanier(){
if (!isset($_SESSION['panier'])){
$_SESSION['panier']=array();
$_SESSION['panier']['libelleProduit'] = array();
$_SESSION['panier']['qteProduit'] = array();
$_SESSION['panier']['prixProduit'] = array();
$_SESSION['panier']['dimensionBase'] = array();
$_SESSION['panier']['dimensionHauteur'] = array();
$_SESSION['panier']['choixDefinition'] = array();
$_SESSION['panier']['choixPlastification'] = array();
$_SESSION['panier']['choixDecoupe'] = array();
$_SESSION['panier']['verrou'] = false;
}
return true;
}
/**
* Ajoute un article dans le panier
* @param string $libelleProduit
* @param int $qteProduit
* @param float $prixProduit
* @return void
*/
function ajouterArticle($libelleProduit,$qteProduit,$prixProduit,$dimensionBase,$dimensionHauteur,$choixDefinition,$choixPlastification,$choixDecoupe){
//Si le panier existe
if (creationPanier() && !isVerrouille())
{
//Si le produit existe déjà on ajoute seulement la quantité
$positionProduit = array_search($libelleProduit, $_SESSION['panier']['libelleProduit']);
if ($positionProduit !== false)
{
$_SESSION['panier']['qteProduit'][$positionProduit] += $qteProduit ;
}
else
{
//Sinon on ajoute le produit
array_push( $_SESSION['panier']['libelleProduit'],$libelleProduit);
array_push( $_SESSION['panier']['qteProduit'],$qteProduit);
array_push( $_SESSION['panier']['prixProduit'],$prixProduit);
array_push( $_SESSION['panier']['dimensionBase'],$dimensionBase);
array_push( $_SESSION['panier']['dimensionHauteur'],$dimensionHauteur);
array_push( $_SESSION['panier']['choixDefinition'],$choixDefinition);
array_push( $_SESSION['panier']['choixPlastification'],$choixPlastification);
array_push( $_SESSION['panier']['choixDecoupe'],$choixDecoupe);
}
}
else
echo "Un problème est survenu veuillez contacter l'administrateur du site.";
}
/**
* Modifie la quantité d'un article
* @param $libelleProduit
* @param $qteProduit
* @return void
*/
function modifierQTeArticle($libelleProduit,$qteProduit,$dimensionBase,$dimensionHauteur,$choixDefinition,$choixPlastification,$choixDecoupe){
//Si le panier éxiste
if (creationPanier() && !isVerrouille())
{
//Si la quantité est positive on modifie sinon on supprime l'article
if ($qteProduit > 0)
{
//Recharche du produit dans le panier
$positionProduit = array_search($libelleProduit, $_SESSION['panier']['libelleProduit']);
if ($positionProduit !== false)
{
$_SESSION['panier']['qteProduit'][$positionProduit] = $qteProduit ;
//$_SESSION['panier']['dimensionBase'][$positionProduit] = $dimensionBase ;
//$_SESSION['panier']['dimensionHauteur'][$positionProduit] = $dimensionHauteur ;
//$_SESSION['panier']['choixDefinition'][$positionProduit] = $choixDefinition ;
//$_SESSION['panier']['choixPlastification'][$positionProduit] = $choixplastification ;
//$_SESSION['panier']['choixDecoupe'][$positionProduit] = $choixDecoupe ;
}
}
else
supprimerArticle($libelleProduit);
}
else
echo "Un problème est survenu veuillez contacter l'administrateur du site.";
}
/**
* Supprime un article du panier
* @param $libelleProduit
* @return unknown_type
*/
function supprimerArticle($libelleProduit){
//Si le panier existe
if (creationPanier() && !isVerrouille())
{
//Nous allons passer par un panier temporaire
$tmp=array();
$tmp['libelleProduit'] = array();
$tmp['qteProduit'] = array();
$tmp['prixProduit'] = array();
$tmp['dimensionBase'] = array();
$tmp['dimensionHauteur'] = array();
$tmp['choixDefinition'] = array();
$tmp['choixPlastification'] = array();
$tmp['choixDecoupe'] = array();
$tmp['verrou'] = $_SESSION['panier']['verrou'];
for($i = 0; $i < count($_SESSION['panier']['libelleProduit']); $i++)
{
if ($_SESSION['panier']['libelleProduit'][$i] !== $libelleProduit)
{
array_push( $tmp['libelleProduit'],$_SESSION['panier']['libelleProduit'][$i]);
array_push( $tmp['qteProduit'],$_SESSION['panier']['qteProduit'][$i]);
array_push( $tmp['prixProduit'],$_SESSION['panier']['prixProduit'][$i]);
array_push( $tmp['dimensionBase'],$_SESSION['panier']['dimensionBase'][$i]);
array_push( $tmp['dimensionHauteur'],$_SESSION['panier']['dimensionHauteur'][$i]);
array_push( $tmp['choixDefinition'],$_SESSION['panier']['choixDefinition'][$i]);
array_push( $tmp['choixPlastification'],$_SESSION['panier']['choixPlastification'][$i]);
array_push( $tmp['choixDecoupe'],$_SESSION['panier']['choixDecoupe'][$i]);
}
}
//On remplace le panier en session par notre panier temporaire à jour
$_SESSION['panier'] = $tmp;
//On efface notre panier temporaire
unset($tmp);
}
else
echo "Un problème est survenu veuillez contacter l'administrateur du site.";
}
/**
* Montant total du panier
* @return int
*/
function MontantGlobal(){
$total=0;
for($i = 0; $i < count($_SESSION['panier']['libelleProduit']); $i++)
{
$total += $_SESSION['panier']['qteProduit'][$i] * $_SESSION['panier']['prixProduit'][$i];
}
return $total;
}
/**
* Fonction de suppression du panier
* @return void
*/
function supprimePanier(){
unset($_SESSION['panier']);
}
/**
* Permet de savoir si le panier est verrouillé
* @return booleen
*/
function isVerrouille(){
if (isset($_SESSION['panier']) && $_SESSION['panier']['verrou'])
return true;
else
return false;
}
/**
* Compte le nombre d'articles différents dans le panier
* @return int
*/
function compterArticles()
{
if (isset($_SESSION['panier']))
return count($_SESSION['panier']['libelleProduit']);
else
return 0;
}
?> |
dans la page fonctions-panier
j'avais modifié le code en pensant que cela allait resoudre le problème mais non il n'est pas résolu.
ce code ajouté est en commentaire
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
/**
* Modifie la quantité d'un article
* @param $libelleProduit
* @param $qteProduit
* @return void
*/
function modifierQTeArticle($libelleProduit,$qteProduit,$dimensionBase,$dimensionHauteur,$choixDefinition,$choixPlastification,$choixDecoupe){
//Si le panier éxiste
if (creationPanier() && !isVerrouille())
{
//Si la quantité est positive on modifie sinon on supprime l'article
if ($qteProduit > 0)
{
//Recharche du produit dans le panier
$positionProduit = array_search($libelleProduit, $_SESSION['panier']['libelleProduit']);
if ($positionProduit !== false)
{
$_SESSION['panier']['qteProduit'][$positionProduit] = $qteProduit ;
//$_SESSION['panier']['dimensionBase'][$positionProduit] = $dimensionBase ;
//$_SESSION['panier']['dimensionHauteur'][$positionProduit] = $dimensionHauteur ;
//$_SESSION['panier']['choixDefinition'][$positionProduit] = $choixDefinition ;
//$_SESSION['panier']['choixPlastification'][$positionProduit] = $choixplastification ;
//$_SESSION['panier']['choixDecoupe'][$positionProduit] = $choixDecoupe ;
}
}
else
supprimerArticle($libelleProduit);
}
else
echo "Un problème est survenu veuillez contacter l'administrateur du site.";
} |
voilà le problème vient quand je clique sur le bouton rafrichir du panier
voilà le code est en ligne a l'adresse suivante
http://www.foliopub.com/revendeur/akylux.php
j'espere que j'ai été clair dans mes explications
merci pour votre aide
|