Précédent   Forum du club des développeurs et IT Pro > PHP > Scripts > E-Commerce
E-Commerce Forum d'entraide sur les scripts de commerce électronique (osCommerce, Magento, etc.). Avant de poster -> Cours e-commerce, Scripts E-commerce
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 29/09/2012, 10h14   #1
antinarius
Candidat au titre de Membre du Club
 
Homme Bernard AVALLET
Photographe
Inscription : mai 2011
Messages : 35
Détails du profil
Informations personnelles :
Nom : Homme Bernard AVALLET
Âge : 68
Localisation : France, Vaucluse (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Photographe

Informations forums :
Inscription : mai 2011
Messages : 35
Points : 12
Points : 12
Par défaut Récupérer les valeurs d'un panier

Bonjour,
J'utilise le tuto du panier de Joris CROZIER pour un petit site e-commerce.
Je récupère sans problème les valeurs émises par le visiteur lorsqu'il choisi les produits.
Mais je n'arrive pas à récupérer ces valeurs sur le bon de commande.
Je galère depuis 2 jours. Je n'utilise pas de BD. Je voudrai simplement les récupérer sur un bon de commande qui serait ensuite transmis par mail à l'entreprise.

Si quelqu'un puvait me mettre sur la voie pour la récupération de ces valeurs se serait super sympas.
Merci
antinarius est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 29/09/2012, 23h35   #2
bambou74
Membre du Club
 
Homme Thomas Hudry
Inscription : mars 2011
Messages : 41
Détails du profil
Informations personnelles :
Nom : Homme Thomas Hudry
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : mars 2011
Messages : 41
Points : 54
Points : 54
Un petit bout de code qu'on puisse regarder ?
bambou74 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/09/2012, 07h53   #3
antinarius
Candidat au titre de Membre du Club
 
Homme Bernard AVALLET
Photographe
Inscription : mai 2011
Messages : 35
Détails du profil
Informations personnelles :
Nom : Homme Bernard AVALLET
Âge : 68
Localisation : France, Vaucluse (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Photographe

Informations forums :
Inscription : mai 2011
Messages : 35
Points : 12
Points : 12
Bonjour,
En faite j'ai réussi à me débatouiller tout seul, j'ai trouvé. j'ai fait de la façon suivante :
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
 
<?php error_reporting(E_ALL ^ E_NOTICE); //supprime le Notice undefined Index "nom de la variable..." etc...?>
<?php session_start();?>
 
 
	$commande = $_SESSION['panier'];
 
	$resultat = $commande['prixProduit'][0] + $commande['prixProduit'][1] + $commande['prixProduit'][2] + $commande['prixProduit'][4];
	?>
 
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Bon de commande</title>
<link href="cssStyle.css" rel="stylesheet" type="text/css">
</head>
 
<body>
 
	<dir id="id290901">
    	<table>
        	<tr class="cls290901">
            	<td>Produits</td>
                <td>Qté</td>
                <td>Prix ttc</td>
            </tr>
 
            <tr>
            	<td class="cls290903">
				   <?php 
						echo $commande['libelleProduit'][0] . '<br/>';
						echo $commande['libelleProduit'][1] . '<br/>';
						echo $commande['libelleProduit'][2] . '<br/>';
                    ?>
				</td>
                <td class="cls290906">
					<?php 
						echo $commande['qteProduit'][0] . '<br/>';
						echo $commande['qteProduit'][1] . '<br/>';
						echo $commande['qteProduit'][2] . '<br/>';
                    ?>
                </td>
                <td class="cls290902">
					<?php
                        echo $commande['prixProduit'][0] . ' €','<br/>';
                        echo $commande['prixProduit'][1] . ' €','<br/>';
                        echo $commande['prixProduit'][2] . ' €', '<br/>';
                    ?>
                </td>
            </tr>
 
            <tr>
                <td colspan="2" class="cls290904">
                	<p>Sous/total</p>
                </td>
                <td class="cls290905">
                	<?php echo $resultat . ' €';?>
                </td>
            </tr>
        </table>
 
    </dir>
 
 
  <p> <a href="logout.php">Annuler ma commande..!</a> </p>
 
</body>
</html>
Par contre j'ai un petit souci, encore un..! quand le client click sur "ajouter au panier" dans la page des produits. un popup s'ouvre avec le panier. Dans ce popup j'ai ajouter un bouton de validation qui appel la page "bon de commande.
Le pblm est le suivant la page "bon de commande s'ouvre dans le popup. Comment faire pour que quand le client valide son panier donc à partir du popup, de fermer celui ci et d'appeller ma page bon de commande?

Je joins le code de ma page de tests "produit" :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
<?php session_start();?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Article</title>
<!--<link href="css/gene130912.css" rel="stylesheet" type="text/css">-->
</head>
 
<body>
 
	<p><a href="panier.php?action=ajout&amp;l=Collier Casimir&amp;q=1&amp;p=15" 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></p>
 
    <p><a href="panier.php?action=ajout&amp;l=Boucles oreille lapilazuli&amp;q=1&amp;p=415">Ajouter au panier</a></p>
 
    <p><a href="panier.php?action=ajout&amp;l=Parure Rubis&amp;q=1&amp;p=50">Ajouter au panier</a></p>
 
</body>
</html>
Voici le code du 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();?>
<?php
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 )) ;
 
   //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);
         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">
<meta charset="utf-8">
<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>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><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>";
	   }
	}
 
			//echo $_SESSION['panier'];
			//echo $_SESSION['p'];
 
	?>
</table>
</form>
 
 
		  <p><a href="bonCommande.php">Validation</a></p>
          <p><a href="logout.php">Abandonner ma commande</a></p>
 
</body>
</html>
Merci pour tes précieux conseils

Antinarius
antinarius est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/09/2012, 10h25   #4
bambou74
Membre du Club
 
Homme Thomas Hudry
Inscription : mars 2011
Messages : 41
Détails du profil
Informations personnelles :
Nom : Homme Thomas Hudry
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : mars 2011
Messages : 41
Points : 54
Points : 54
Ok j'ai pas vraiment donné de conseil mais bon
Pense a passer le topic en résolu
EDIT:
je viens de voire que tu avais un autre problème je devais vraiment avoir la tête dans le saut ce matin
Pour ton deuxième problème va plutôt poster dans la section javascript
bambou74 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Cette discussion est résolue.
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 07h02.


 
 
 
 
Partenaires

Hébergement Web