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
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-------------------*/
Re: 1064 when clicking paypal checkout button and not logged in as a user
Try changing this:
Code:
$customer_whole_obj = $db->Execute('select `customers_whole` from `'.TABLE_CUSTOMERS.'` where `customers_id` ='.$_SESSION['customer_id']);
to this:
Code:
$customer_whole_obj = $db->Execute('select customers_whole from '.TABLE_CUSTOMERS.' where customers_id ='.(int)$_SESSION['customer_id']);