Bug bouton précédent/suivant panier en php
tipi75
Messages postés
723
Statut
Membre
-
david_wklw Messages postés 43 Statut Membre -
david_wklw Messages postés 43 Statut Membre -
Bonjour,
J'ai un soucis lorsque je fais précédent et suivant du navigateur après avoir ajouté un article dans le panier. Lorsque je fais cette action la quantité de l'article ajouté augmente de 1.
Je ne vais pas vous mettre tout le code en revanche le tuto suivant:
https://jcrozier.developpez.com/articles/web/panier/
Merci pour votre aide
J'ai un soucis lorsque je fais précédent et suivant du navigateur après avoir ajouté un article dans le panier. Lorsque je fais cette action la quantité de l'article ajouté augmente de 1.
Je ne vais pas vous mettre tout le code en revanche le tuto suivant:
https://jcrozier.developpez.com/articles/web/panier/
Merci pour votre aide
A voir également:
- Bug bouton précédent/suivant panier en php
- Diagnostic bouton photo - Accueil - Outils
- Bug chromecast - Guide
- Iptv bug forum ✓ - Forum Box et Streaming vidéo
- Bouton on/off comment savoir ✓ - Forum Matériel & Système
- Symbole arrêt marche - Forum Word
4 réponses
Si j'ai bien compris, ce script, pour ajouter un article tu passes par :
<a href="panier.php?action=ajout&l=LIBELLEPRODUIT&q=QUANTITEPRODUIT&p=PRIXPRODUIT" onclick="window.open(this.href, '',
'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;">Ajouter au panier</a>
C'est un lien hypertexte avec les renseignements de l'article.
Ensuite ca passa a la moulinette :
function ajouterArticle($libelleProduit,$qteProduit,$prixProduit){
//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);
}
}
else
echo "Un problème est survenu veuillez contacter l'administrateur du site.";
}
Et là, il y a :
//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 ;
}
Donc ca me parait normal que ca ajoute chaque fois un article, c'est pas un bug, that's a feature !
<a href="panier.php?action=ajout&l=LIBELLEPRODUIT&q=QUANTITEPRODUIT&p=PRIXPRODUIT" onclick="window.open(this.href, '',
'toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=600, height=350'); return false;">Ajouter au panier</a>
C'est un lien hypertexte avec les renseignements de l'article.
Ensuite ca passa a la moulinette :
function ajouterArticle($libelleProduit,$qteProduit,$prixProduit){
//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);
}
}
else
echo "Un problème est survenu veuillez contacter l'administrateur du site.";
}
Et là, il y a :
//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 ;
}
Donc ca me parait normal que ca ajoute chaque fois un article, c'est pas un bug, that's a feature !