Closed (duplicate)
Project:
e-Commerce
Version:
master
Component:
cart.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Oct 2005 at 17:44 UTC
Updated:
2 Dec 2005 at 01:51 UTC
According to the settings it should be allowed to check-out without being logged in as a user. When click on check-out I get:
user error: Unknown column '4ed3ef1e0c39ab290bbc7736961856af' in 'where clause'
query: DELETE FROM ec_tmp WHERE sid = 4ed3ef1e0c39ab290bbc7736961856af in /home/c2/Clients/drupal.cvs/public_html/includes/database.mysql.inc on line 108.I see only an email field but the heading asks me a shipping and billing address. There must be something wrong with this.
Comments
Comment #1
ñull commentedWatchdog description of this error:
Comment #2
averageyoungman commentedThis is definitely odd, but I figured some of this out.
First, the problem regarding the missing billing and shipping forms is twofold, and both issues are in the function "theme_address_checkout_form()" in address.module.
1) the if() statement on line 126 is comparing against a variable that doesn't appear to exist outside of the $txn object. If you change that to $txn->shippable, then the code in the if() will be executed.
2) The output for the forms themselves isn't returned. On lines 128 & 129, you will see the following:
$shipping_form = store_transaction_addresses_form($edit, 'shipping');
$billing_form = store_transaction_addresses_form($edit, 'billing');
These two lines need to be added to the $output that is eventually returned. If you make the two changes above, you will see the billing and shipping forms.
Here's the weird portion relevant to the sql errors. In cart.module starting on line 804, there are a few functions dealing with session and user id's. In the function "ec_checkout_hide_data()", the current sid is deleted and then reinserted into the db. On line 819, the function "ec_checkout_delete_data()" handles the deletion of the sid, by using a wildcard and a call to "cart_get_id()." I know that the id returned from cart_get_id() is a string, because checking it with gettype() confirms it is. Also, the sid field in the ec_tmp table is a varchar, which should make it a string as well. Despite both these facts, if I change the wildcard in "ec_checkout_delete_data()" from '%s' to '%d', which treats the wildcard argument as an integer, the error doesn't occur. I am unsure whether that will cause a problem somewhere else down the line, but it doesn't appear to affect the checkout process for logged in users. Hopefully someone else can help in this regard. I will report back if I make any further findings.
-- aym
Comment #3
jessethouin commentedSimply change
db_query("DELETE FROM {ec_tmp} WHERE sid = %s", cart_get_id());to this
db_query("DELETE FROM {ec_tmp} WHERE sid = '%s'", cart_get_id());Notice the single quotes around the variable.
Comment #4
matt westgate commentedDuplicate of #37220