IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

EDI, CMS, Outils, Scripts et API PHP Discussion :

[PayPal] Interface avec Paypal


Sujet :

EDI, CMS, Outils, Scripts et API PHP

  1. #41
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Non, var_dump() affiche juste l'etat de la variable.
    Le but est de trouver quelle partie de ton code pose probleme en trouvant a partir de quelle ligne la variable perd sa valeur.

  2. #42
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Voilà j'ai un message d'erreur:

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\infortech\account\traitement_commande.php on line 118

    Il te faut quoi maintenant que j'ai fait ça?

  3. #43
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Il perd pas sa valeur mais c'est message d'erreur.

  4. #44
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Voilà ce que j'obtiens au maximum:

    Array ( [id] => 22 [client] => julie.vaissier@aliceadsl.fr [date] => 2009-08-22 [total_ht] => 2.47 [total_ttc] => 2.95 [expedition] => )

    au lieu de:

    Array ( [id] => 22 [client] => julie.vaissier@aliceadsl.fr [date] => 2009-08-22 [total_ht] => 2.47 [total_ttc] => 2.95 [expedition] => ) string(4) "2.95"


    Je perd jamais plus d'infos.

  5. #45
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Quand tu n'as plus le string(4) "2.95" c'est que ta valeur a disparu.
    Il faut que tu reperes a partir de quel ligne elle disparait.

  6. #46
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Dès que je fais ceci:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <?php
    $paramclient_commande = "0";
    if (isset($_SESSION['MM_Username'])) {
      $paramclient_commande = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_infortech, $infortech);
    $query_commande = sprintf("SELECT * FROM shop_commande WHERE client='%s'  ORDER BY shop_commande.id DESC", $paramclient_commande);
    $commande = mysql_query($query_commande, $infortech) or die(mysql_error());
    $row_commande = mysql_fetch_assoc($commande);
    print_r ($row_commande);
     
    die();var_dump($row_commande['total_ttc']);
    ?>

  7. #47
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Il faut retirer le die();

  8. #48
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Bon c'est fait sans le "die".

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <?php
    $paramclient_commande = "0";
    if (isset($_SESSION['MM_Username'])) {
      $paramclient_commande = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_infortech, $infortech);
    $query_commande = sprintf("SELECT * FROM shop_commande WHERE client='%s'  ORDER BY shop_commande.id DESC", $paramclient_commande);
    $commande = mysql_query($query_commande, $infortech) or die(mysql_error());
    $row_commande = mysql_fetch_assoc($commande);
    print_r ($row_commande);
     
    ?>var_dump($row_commande['total_ttc']);

  9. #49
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    tu n'as pas compris :
    - il faut descendre la ligne
    - regarder si on a toujours la valeur
    - si oui, descendre la ligne et regarder
    - si non, tu as trouvé ou la valeur est perdu

  10. #50
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    C'est impossible. J'arrête pas de descendre et y a toujours rien.

  11. #51
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Ca veut dire quoi "toujours rien" ? la valeur apparait toujours ou elle n'apparait jamais ?

    Tu sais tu nous aurais montré le code on aurait evité ca.

  12. #52
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    La valeur est toujours là.

    C'est pas que je veux pas le montrer le code mais je sais pas lequel tu veux. J'ai donné ceux qui me posent problèmes. Parce que des requêtes j'en ai pas mal.

  13. #53
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Si tu mets le var_dump() juste avant le formulaire tu as quoi ?

  14. #54
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Donc je vais te donner tout ce que j'ai sur ma page.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    session_start();
    $MM_authorizedUsers = "";
    $MM_donotCheckaccess = "true";
     
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
      // For security, start by assuming the visitor is NOT authorized. 
      $isValid = False; 
     
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
      // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
      if (!empty($UserName)) { 
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
        // Parse the strings into arrays. 
        $arrUsers = Explode(",", $strUsers); 
        $arrGroups = Explode(",", $strGroups); 
        if (in_array($UserName, $arrUsers)) { 
          $isValid = true; 
        } 
        // Or, you may restrict access to only certain users based on their username. 
        if (in_array($UserGroup, $arrGroups)) { 
          $isValid = true; 
        } 
        if (($strUsers == "") && true) { 
          $isValid = true; 
        } 
      } 
      return $isValid; 
    }
     
    $MM_restrictGoTo = "../login.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
      $MM_referrer .= "?" . $QUERY_STRING;
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo); 
      exit;
    }
     
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
     
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
     
    ?>
    Ensuite:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <?php
    $paramclient_commande = "0";
    if (isset($_SESSION['MM_Username'])) {
      $paramclient_commande = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_infortech, $infortech);
    $query_commande = sprintf("SELECT * FROM shop_commande WHERE client='%s'  ORDER BY shop_commande.id DESC", $paramclient_commande);
    $commande = mysql_query($query_commande, $infortech) or die(mysql_error());
    $row_commande = mysql_fetch_assoc($commande);
    print_r ($row_commande);
    var_dump($row_commande['total_ttc']);
    die();
    ?>

    Puis:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     <?php
     
    if (isset($_SESSION['MM_Username'])) {
      mysql_select_db($database_infortech, $infortech);
      $query_commande = sprintf("SELECT id
                                 FROM shop_commande
                                 WHERE client ='".$_SESSION['MM_Username']."'
                                 ORDER BY id DESC");
      $commande = mysql_query($query_commande, $infortech) or die(mysql_error());
      $row_commande = mysql_fetch_assoc($commande);
      $totalRows_commande = mysql_num_rows($commande);
      mysql_select_db($database_infortech, $infortech);
      $query_panier = sprintf("SELECT shop_panier.*,
                                      shop_produits.prix_ht,
                                      shop_produits.prix_ttc,
                                      shop_produits.prix_ht*shop_panier.quantite AS total_ht,
                                      shop_produits.prix_ttc*shop_panier.quantite AS total_ttc
                               FROM shop_panier 
                               INNER JOIN shop_produits 
                                ON shop_produits.id=shop_panier.article
                               WHERE client = '".$_SESSION['MM_Username']."'");
      $panier = mysql_query($query_panier, $infortech) or die(mysql_error());
      $totalRows_panier = mysql_num_rows($panier);
     
      $compteur = 0;
      while ($row_panier = mysql_fetch_assoc($panier) and $compteur < $totalRows_panier)
       {
        $query_ligne_commande = sprintf("INSERT 
                                         INTO shop_ligne_commande (commande, article, prix_ht, prix_ttc, quantite, total_ht, total_ttc) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                                         GetSQLValueString($row_commande['id'], "int"),
                                         GetSQLValueString($row_panier['article'], "int"),
                                         GetSQLValueString($row_panier['prix_ht'], "double"),
                                         GetSQLValueString($row_panier['prix_ttc'], "double"),
                                         GetSQLValueString($row_panier['quantite'], "int"),
                                         GetSQLValueString($row_panier['total_ht'], "double"),
                                         GetSQLValueString($row_panier['total_ttc'], "double"));
        mysql_select_db($database_infortech, $infortech);
        $Result1 = mysql_query($query_ligne_commande, $infortech) or die(mysql_error());
     
        $query_suppr_panier = sprintf("DELETE FROM shop_panier WHERE id=%s",
                                       GetSQLValueString($row_panier['id'], "int"));
        mysql_select_db($database_infortech, $infortech);
        $Result1 = mysql_query($query_suppr_panier, $infortech) or die(mysql_error());
     
        $compteur = $compteur+1; 
       }
      }
     
    ?>
    Et pour finir:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     <form action="https://www.paypal.com/fr/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="webmaster@informatique-jhv.com">
    <input type="hidden" name="item_name" value="<?php echo $row_commande['id']; ?>">
    <input type="hidden" name="item_number" value="<?php echo $row_commande['client']; ?>">
    <input type="hidden" name="amount" value="<?php echo $row_commande['total_ttc']; ?>">
    <input type="hidden" name="currency_code" value="EUR">
    <input type="hidden" name="return" value="http://www.accueil.com">
    <input type="image" src="http://www.paypal.com/fr_FR/i/btn/x-click-but01.gif" name="submit" alt="Effectuez vos paiements via PayPal : une solution rapide, gratuite et sécurisée">
    </form>

  15. #55
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Il y a deux fois la requete $query_commande et dans la deuxieme, tu n'as que la colonne "id"

    Retire tout ca :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     mysql_select_db($database_infortech, $infortech);
      $query_commande = sprintf("SELECT id
                                 FROM shop_commande
                                 WHERE client ='".$_SESSION['MM_Username']."'
                                 ORDER BY id DESC");
      $commande = mysql_query($query_commande, $infortech) or die(mysql_error());
      $row_commande = mysql_fetch_assoc($commande);
      $totalRows_commande = mysql_num_rows($commande);
    et les controles evidemment
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    print_r ($row_commande);
    var_dump($row_commande['total_ttc']);
    die();

  16. #56
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Tu m'excuse Sabotage mais là j'ai mais petits yeux qui se ferment tous seuls.

    Je regarde demain ce que tu viens de me donner.

    Et peut-être si tu veux et peux encore m'aider ça serait sympa.

    Mais déjà merci pour tout ce que tu as fais.

  17. #57
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Non là j'arrive à rien. A demain peut-être.

  18. #58
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Super ça fonctionne en très grande partie. Maintenant dans la page paypal "ID" s'affiche et le montant total aussi. En revanche le "client" non.

    Puis je voudrais savoir une dernière chose:
    le client qui achète sur ma boutique, pour payer avec paypal il doit obligatoirement être inscrit à paypal?
    Si oui, existe-t-il un moyen pour faire en sorte que mes client qui ne sont pas inscrits à paypal puissent payer tout de même?

Discussions similaires

  1. Paiement avec paypal
    Par mariepierre dans le forum E-Commerce
    Réponses: 0
    Dernier message: 16/02/2009, 15h37
  2. PayPal, problème avec IPN
    Par HwRZxLc4 dans le forum E-Commerce
    Réponses: 0
    Dernier message: 10/12/2008, 20h54
  3. Problème avec paypal
    Par Coussati dans le forum Applications
    Réponses: 7
    Dernier message: 04/03/2006, 23h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo