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

ñull’s picture

Watchdog description of this error:

Duplicate entry '4ed3ef1e0c39ab290bbc7736961856af' for key 1 query: INSERT INTO ec_tmp (sid, tmp) VALUES ('4ed3ef1e0c39ab290bbc7736961856af', 'O:8:\"stdClass\":6:{s:6:\"screen\";i:0;s:5:\"items\";a:1:{i:2;O:8:\"stdClass\":18:{s:9:\"cookie_id\";s:32:\"4ed3ef1e0c39ab290bbc7736961856af\";s:3:\"nid\";s:1:\"2\";s:3:\"qty\";s:1:\"1\";s:7:\"changed\";s:10:\"1130000090\";s:4:\"data\";s:6:\"a:0:{}\";s:3:\"sku\";s:10:\"devcub3945\";s:5:\"price\";s:5:\"16.00\";s:12:\"is_recurring\";s:1:\"0\";s:14:\"price_interval\";s:1:\"0\";s:10:\"price_unit\";s:0:\"\";s:11:\"price_cycle\";s:1:\"0\";s:11:\"auto_charge\";s:1:\"0\";s:5:\"ptype\";s:8:\"tangible\";s:14:\"hide_cart_link\";s:1:\"0\";s:5:\"stock\";s:1 in /home/c2/Clients/drupal.cvs/public_html/includes/database.mysql.inc on line 108.
averageyoungman’s picture

This 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

jessethouin’s picture

Simply 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.

matt westgate’s picture

Status: Active » Closed (duplicate)

Duplicate of #37220