Zen Cart Logo
Forums / General Questions / New customer account generates error

New customer account generates error

Views: 1,564

Results 1 to 15 of 15
15 Dec 2011, 6:09 PM
#1
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

New customer account generates error

ZC 1.3.9h

When I tried to test my new store with the first order by creating a new customer account I received this error:

1062 Duplicate entry '3' for key 1
in:
[insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, customers_info_date_of_last_logon) values ('3', '1', now(), now())]

Any ideas? (it may have something to do with the Master Password addon) Thanks.

15 Dec 2011, 6:22 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: New customer account generates error

What exactly do you mean by "my new store"?

The only reason you'd get a "duplicate entry" error on the "customers_info" table is if you had previously had customers in your store, and then manually went into the database and hacked out records from the "customers" table, and didn't also clean up the several ADDITIONAL tables that also contain related customer data.
Same thing happens if you create a new database and try to "pick and choose" selected tables to copy over instead of copying EVERYTHING.

So ... what's the history behind how you got to where you're at right now?

26 Dec 2011, 2:16 AM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: New customer account generates error

A couple of people have gotten into this pickle. It will occur when you hand add or delete records from customers or customer info.

If you're in this situation. your best bet would be to add records to customer_info and/or customers table until they have the same which match the records in the customers table; you probably tried to add to customers without adding to customer_info.

26 Dec 2011, 10:01 PM
#4
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

Re: New customer account generates error

DrByte:

What exactly do you mean by "my new store"?

So ... what's the history behind how you got to where you're at right now?

I Just finished setting up all the products in the shopping cart on my site and getting ready to go online. I had created a test customer account initially to test the cc payment gateway and order e-mail function. I then deleted this test customer account from the Admin-Customer panel. I then tried to enter an actual customer order and received this error when I was creating her account. From that point, I tried to create another 2 test customer accounts and the error was encountered each time (only difference is the customer id will increment by 1).
The interesting part is I did not manually hack into the database to alter the records in anyway (I don't even know how to). The customer deletion was done through Admin-Customers panel and customer account creation was done through the shopping cart front end.

I have gone into myPHPadmin to look at the records in the customers and customers_info tables, they both match. Interestingly enough, although the error is generated, the new customer accounts are created with all the right info. I can close the browser reopen another and log into the newly created account with no problems. This is very baffling since the error is comlplaining about a duplicate for a new record (I can understand if there is an existing record of the same id, hence the duplicate but therer isn't)

26 Dec 2011, 10:06 PM
#5
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

Re: New customer account generates error

swguy:

A couple of people have gotten into this pickle. It will occur when you hand add or delete records from customers or customer info.

If you're in this situation. your best bet would be to add records to customer_info and/or customers table until they have the same which match the records in the customers table; you probably tried to add to customers without adding to customer_info.

I checked both tables and all records match between the customers and the customers_info table (there are only 3 customers records, 1 is actual, 2 are test customers). I do not know how to add records to individual table as of yet.

Thanks for all the replies, maybe we can find a solution soon.

26 Dec 2011, 10:22 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: New customer account generates error

It's not the count, it's the first column - the key - that you need to tell us about.

One must be greater than the other if you're getting that error.

26 Dec 2011, 10:35 PM
#7
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

Re: New customer account generates error

The first column is the customer_info_id, and each id is unique and increments by 1 each time a new customer account is created.
I have tried deleting all the customers from the admin-csutomers panel and verified that there are 0 records, the error still persist when creating a new customer and the customer_id / customer_info_id will continue to increment instead of starting over at 0.

If you need any other info, let me know, thanks.

26 Dec 2011, 10:40 PM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: New customer account generates error

The second screenshot showed one record in customer_info with id 7. So you haven't deleted all the records from that table.

Double check your copy of admin/customers.php against a fresh download of 139h to be sure it hasn't been changed.

26 Dec 2011, 10:45 PM
#9
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

Re: New customer account generates error

Sorry I should have calrified. The record in the screen shot is another test account entered after I deleted all the customer records (id 4,5 and 6). The error is still there.

The very first customer account I setup had no problems, the customers.php file havn't changed subsequently but I will check into that when I get a chance, thanks.

26 Dec 2011, 10:48 PM
#10
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: New customer account generates error

Take a screenshot of customer_info and customers so we can see them both in their current state.

26 Dec 2011, 10:57 PM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,695
Plugin Contributions:
56

Re: New customer account generates error

Just do this through admin->tools->Install sql patches

insert into customers (customers_id) values (10);
insert into customers_info (customers_info_id) values (10);

(assuming your highest number in either table is less than 10; otherwise bump it to 1 higher than the highest number).
Then try creating an account using the shopping cart account creation process.

26 Dec 2011, 11:00 PM
#12
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

Re: New customer account generates error

Here is a screen shot of the customers table.

26 Dec 2011, 11:30 PM
#13
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

Re: New customer account generates error

swguy:

Just do this through admin->tools->Install sql patches

insert into customers (customers_id) values (10);
insert into customers_info (customers_info_id) values (10);

(assuming your highest number in either table is less than 10; otherwise bump it to 1 higher than the highest number).
Then try creating an account using the shopping cart account creation process.

Nope, same error with id 11 now.

27 Dec 2011, 6:29 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: New customer account generates error

None of this should happen with unaltered core code, since it goes to great lengths to keep all the records in sync with each other.

You said you were deleting a "test customer". Did you first delete the orders associated with that customer?

1 Jan 2012, 12:45 AM
#15
michaelchu avatar

michaelchu

Zen Follower

Join Date:
Nov 2011
Posts:
121
Plugin Contributions:
0

Re: New customer account generates error

The order was deleted along with the test customer.
I finally got around to compare the current customer.php with the original the only difference is the statements inserted by the customer referral add-on (see the following):

<!-- bof rmh -->
                <td class="dataTableHeadingContent" align="left" valign="top">
                  <?php echo (($_GET['list_order']=='id-asc' or $_GET['list_order']=='id-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_REFERRED_BY . '</span>' : TABLE_HEADING_REFERRED_BY); ?><br>
                  <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=id-asc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='id-asc' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 
                  <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=id-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='id-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a>
                </td>
<!-- eof rmh -->
//rmh referral start
      $source_query = "select customers_info_source_id  from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers->fields['customers_id'] . "'";
      $source = $db->Execute($source_query);
      $entry_referral = zen_get_sources_name($source->fields['customers_info_source_id'], $customers->fields['customers_id']);
//rmh referral end
<!-- bof rmh -->
                <td class="dataTableContent"><?php echo $entry_referral; ?></td>
<!-- eof rmh -->