I have set up store & using addon module commerce_addressfield. Only email ID for creating account is required at the set up. But when I am trying to checkout & expecting it to create user account...it's giving me this error at the end --

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 23 [:db_insert_placeholder_1] => 1363433406 ) in drupal_write_record() (line 7106 of$base_url/includes/common.inc).

Comments

rszrama’s picture

Title: Integrity constraint violation: 1062 Duplicate entry '' for key 'name' » Ensure commerce_order_get_properties() doesn't supply a duplicate name for mail_username
Version: 7.x-1.5 » 7.x-1.x-dev

Sounds like you're just using the same or similar e-mail address for two anonymous users. We should add checking to commerce_order_get_properties() to make sure it doesn't use an existing username.

rszrama’s picture

Status: Active » Fixed

Actually, looking back at your error message now, it actually looks like you somehow have a blank e-mail address and the duplication is caused by an attempt to insert a new "anonymous" row in the users table. I'd look at your Rule and ensure it's still properly pulling the e-mail address from commerce-order:mail.

In any event, I have just committed a fix to prevent duplicate usernames, which was possible if you used a hyphen in an e-mail address in one case and for another order put a character in that place that gets converted to a hyphen.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/e24335f

rajeevk’s picture

Yeah it's fixed by your help.

Thanks :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.