Forums / PayPal Express Checkout support / 1064 when clicking paypal checkout button and not logged in as a user

1064 when clicking paypal checkout button and not logged in as a user

Views: 1,611

Results 1 to 3 of 3
9 Apr 2014, 12:16 AM
#1
phil_c avatar

phil_c

New Zenner

Join Date:
Apr 2014
Location:
Kitchener, Ontario
Posts:
6
Plugin Contributions:
0

1064 when clicking paypal checkout button and not logged in as a user

Hello

This is an unusual problem, and probably doesn't belong here (apologies in advance),, I would like to ask if anyone could point me in the right direction.

My zencart has been customized, the original programmer MIA, trying to find problem myself, I have limited knowledge of php or sql, but learning.

When clicking on the Checkout with PAYPAL button (not logged in as a user) - I get an error page:

WARNING: An Error occurred, please refresh the page and try again.

Reading through these forums, I learned to check the error logs and here is what I have:

PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 :: select customers_whole from customers where customers_id = in /home3/kwmagicc/public_html/includes/classes/db/mysql/query_factory.php on line 120

I looked at that file and could not see the problem, not that I was expecting it to jump out and bite me, but I fear I am looking at the wrong file.

Now I assume it has something to do with the wholesale pricing module not coded correctly, but could use a little guidance as to where to check next.

Any help appreciated

Phil

9 Apr 2014, 2:16 AM
#2
phil_c avatar

phil_c

New Zenner

Join Date:
Apr 2014
Location:
Kitchener, Ontario
Posts:
6
Plugin Contributions:
0

Re: 1064 when clicking paypal checkout button and not logged in as a user

tracking it down to a piece of custom code maybe - I can't see the problem:

/*------------------------------Whole sale customer code-------------------*/
$customer_whole_obj = $db->Execute('select `customers_whole` from `'.TABLE_CUSTOMERS.'` where `customers_id` ='.$_SESSION['customer_id']);
$customer_whole = $customer_whole_obj->fields['customers_whole'];
if($customer_whole == 4){
  $_SESSION['customer_level'] =4; 
	//print_r($_SESSION);
  if($_SESSION['payment'] == 'paypalwpp' || $_SESSION['payment'] =='cc'){
    $this->info['charges'] = 2.5;
    $this->info['total_without_charges'] = $this->info['total'];
    $this->info['charges_amt'] = ($this->info['total'] * $this->info['charges'])/100;
    $this->info['total'] = $this->info['total'] + $this->info['charges_amt'];
  }
}
/*------------------------------End Whole sale customer code-------------------*/
16 Apr 2014, 2:34 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: 1064 when clicking paypal checkout button and not logged in as a user

Try changing this:$customer_whole_obj = $db->Execute('select `customers_whole` from `'.TABLE_CUSTOMERS.'` where `customers_id` ='.$_SESSION['customer_id']);to this:```
$customer_whole_obj = $db->Execute('select customers_whole from '.TABLE_CUSTOMERS.' where customers_id ='.(int)$_SESSION['customer_id']);

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.