Zen Cart Logo
Forums / Addon Shipping Modules / You Have An Error in Your SQL Syntax with FEDEX

You Have An Error in Your SQL Syntax with FEDEX

Locked

Views: 2,349

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
26 Jun 2009, 1:31 PM
#1
engine411 avatar

engine411

New Zenner

Join Date:
Jun 2008
Location:
Bird-in-Hand, Pennsylvania
Posts:
64
Plugin Contributions:
0

You Have An Error in Your SQL Syntax with FEDEX

Hello, when I add any product that has attributes (such as two sizes) to my cart, and with Fedex shipping enabled, I get this:
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 ':44d38b46b1d3c53f1a372560a64762ea LIMIT 1' at line 1
in:
[SELECT products_length, products_width, products_height, products_ready_to_ship, product_is_always_free_shipping FROM products WHERE products_id = 12:44d38b46b1d3c53f1a372560a64762ea LIMIT 1]

If I turn Fedex off, everything's Ok. The Fedex mod seems to be installed correctly, as we can get realtime quotes for non-attribute products and the meter id's are present in the admin.

Anyone? Thanks.

2 Jul 2009, 1:40 AM
#2
engine411 avatar

engine411

New Zenner

Join Date:
Jun 2008
Location:
Bird-in-Hand, Pennsylvania
Posts:
64
Plugin Contributions:
0

Re: You Have An Error in Your SQL Syntax with FEDEX

Here's what my local html/sql tech had to say:

Under modules/shipping there are two fedex files: fedexexpress.php and fedexground.php (and there would possibly be more for each fedex method you install). In those files there’s a function called “getDimensions()”. This function runs a call to $_SESSION[‘cart’]->get_products(). For some reason, products with attributes come back with an ID that has a colon and some other digits attached to it (like what you saw in the sql error).

It seems like there would be a better way to handle this, but this solution works:

Add the following code right after the line that says “foreach($products as $product){“

$prid = $product['id'];

if(stripos($prid, ':')) $prid = substr($product['id'],0,stripos($prid, ':'));

The next line starts out with $sql = $db->Execute(… Find “$product[‘id’]” in that line and replace it with “$prid” (the variable created above.

Seems to work. Fedex is operational.