Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Posts
    231
    Plugin Contributions
    0

    Default Paypal Express SQl Error on Checkout

    I am using Zen Cart 1.3.8a
    I have a couple of modules installed, (i.e. EZ Populate, Reward Points, some custom sideboxes, etc.)

    I got a report this morning from a Customer. he tried to purchase an item using the Paypal Express, it gave him a sql error

    I discovered that it is giving this error whenever the customer is not logged in and they try to use the Paypal Express button

    You can easily reproduce this by going to http://shop.ironcrown.com and putting any item in a shopping cart and hitting the paypal express button on the shopping cart page

    My settings for Paypal Express are as follows:
    -----------------------------------------------------------------------
    Enable this Payment Module
    True

    Sort order of display.
    2

    Payment Zone
    --none--

    Set Order Status
    Paid [2]

    Set Unpaid Order Status
    Pending [1]

    Set Refund Order Status
    Canceled [6]

    Express Checkout: Require Confirmed Address
    No

    Express Checkout: Select Cheapest Shipping Automatically
    No

    Express Checkout: Skip Payment Page
    No

    Express Checkout: Automatic Account Creation
    Yes

    Payment Action
    Final Sale

    Transaction Currency
    Only USD

    PayPal Page Style
    Primary

    API Signature -- Username
    --removed--

    API Signature -- Password
    ****************

    API Signature -- Signature Code
    --removed--

    PayPal Mode
    PayPal

    Live or Sandbox
    live

    Debug Mode
    Off
    -----------------------------------------------------------------------

    Can somebody please tell me how to fix this so that I don't get these sql errors anymore.

  2. #2

    Default Re: Paypal Express SQl Error on Checkout

    It looks like the error is caused by your reward points module.

    The problem with the sql is the bit that says
    Code:
    WHERE c.customers_id=
    the value for c.customers_id cannot be emtpty. You will need to go find the place where the sql executes (if you have dreamweaver you can easily do a search in the folders) and just wrap single quotes around the customers id variable.

    So then the query would look like:

    Code:
     WHERE c.customers_id=''
    when the user is not logged in, and that shouldn't give any errors.
    http://www.customscripts.co.za - Custom development for open-source applications

    http://www.pcservice.co.za - Website Development, Domain Registration, Hosting

  3. #3

    Default Re: Paypal Express SQl Error on Checkout

    Maybe if you can tell me what rewards module you are using and where to get it, I can tell you the exact place where to edit the code and what needs to be changed.
    http://www.customscripts.co.za - Custom development for open-source applications

    http://www.pcservice.co.za - Website Development, Domain Registration, Hosting

  4. #4
    Join Date
    Aug 2006
    Posts
    231
    Plugin Contributions
    0

    Default Re: Paypal Express SQl Error on Checkout

    The Rewards Point module is the one made by hem -- not sure of exact link to find it off-hand.

  5. #5

    Default Re: Paypal Express SQl Error on Checkout

    Open the file includes/function/extra_functions/reward_points_functions.php

    Look for the code (around line 141):

    PHP Code:
    function GetRedeemRatio($customers_id)
    {
        global 
    $db;
        
        
    $sql "SELECT redeem_ratio 
                FROM "
    .TABLE_REWARD_MASTER." prp, ".TABLE_CUSTOMERS." as c
                LEFT JOIN("
    .TABLE_GROUP_PRICING." as gp) ON (gp.group_id=c.customers_group_pricing)
                WHERE c.customers_id="
    .(int)$customers_id."
                AND ((prp.scope_id="
    .$customers_id." AND prp.scope=".SCOPE_CUSTOMER.")
                OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope="
    .SCOPE_GROUP.")
                OR (prp.scope="
    .SCOPE_GLOBAL."))
                ORDER BY prp.scope DESC LIMIT 1;"


        
    $result=$db->Execute($sql);

        if(
    $result)
         return 
    $result->fields['redeem_ratio'];
        else
         return 
    0;


    and replace it with:

    PHP Code:
    function GetRedeemRatio($customers_id)
    {
        global 
    $db;
        
        
    $sql "SELECT redeem_ratio 
                FROM "
    .TABLE_REWARD_MASTER." prp, ".TABLE_CUSTOMERS." as c
                LEFT JOIN("
    .TABLE_GROUP_PRICING." as gp) ON (gp.group_id=c.customers_group_pricing)
                WHERE c.customers_id='"
    .(int)$customers_id."'
                AND ((prp.scope_id='"
    .$customers_id."' AND prp.scope='".SCOPE_CUSTOMER."')
                OR (gp.group_id=c.customers_group_pricing AND prp.scope_id=gp.group_id AND scope='"
    .SCOPE_GROUP."')
                OR (prp.scope='"
    .SCOPE_GLOBAL."'))
                ORDER BY prp.scope DESC LIMIT 1;"


        
    $result=$db->Execute($sql);

        if(
    $result)
         return 
    $result->fields['redeem_ratio'];
        else
         return 
    0;

    http://www.customscripts.co.za - Custom development for open-source applications

    http://www.pcservice.co.za - Website Development, Domain Registration, Hosting

  6. #6
    Join Date
    Aug 2006
    Posts
    231
    Plugin Contributions
    0

    Default Re: Paypal Express SQl Error on Checkout

    thanks! That seems to have fixed it...

 

 

Similar Threads

  1. PayPal Express Checkout Error 82001 - Unspecified Method Error
    By jmsnyder23 in forum PayPal Express Checkout support
    Replies: 9
    Last Post: 12 Sep 2015, 05:12 PM
  2. paypal express checkout error 1.3.9d
    By headache! in forum PayPal Express Checkout support
    Replies: 11
    Last Post: 30 Aug 2011, 08:51 AM
  3. Paypal Express Checkout Error
    By tthenne in forum PayPal Express Checkout support
    Replies: 6
    Last Post: 18 Apr 2011, 09:13 PM
  4. Replies: 11
    Last Post: 16 May 2009, 04:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR