This is a discussion on customer primary address not set when new account created? within the osCMax v2 Customization/Mods forums, part of the osCMax v2.0 Forums category; When a csutomer creates a new account, the address they enter during sign-up is not used at their Primary Address. ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| ||||
| ||||
| When a csutomer creates a new account, the address they enter during sign-up is not used at their Primary Address. So when they go to checkout the first time, there is no address listed in the Primary Address and won't let them checkout becasue shipping cannot be calculated. They can then go set their address as primary address, but this is not very intuitive. Is this how it is supposed to work? If so, is there a way to set the user's address as Primary Address by default? thx, C |
| Sponsored Links | ||
| ||
| |
|
#2
| ||||
| ||||
| That is not how it works in a default install. When you create an account, the address IS set to the primary shipping address. If that is not how it is working on your shop, you have borked something for sure...
__________________ Michael Sasek osCMax Developer
|
|
#3
| ||||
| ||||
| That's what I was afraid of... Any advice on what table(s) to start looking at and for what errors? Thx, C |
|
#4
| ||||
| ||||
| Did you migrate the data from a different version of osC? I have see this behavior when the addressbook ID's do not match across the address_book table and the customer table. That is where I would look first.
__________________ Michael Sasek osCMax Developer
|
|
#5
| ||||
| ||||
| Yes, I migrated from an older osC2.1 to the newer oscmax2. It's been a rough migration, but I am nearly done. After looking at the database schema diagram, it looks like there are two corresponding fields in the tables you mention:
When a new customer registers, they're address_book_id = 1, and customers_default_address_id = 0. This must be the problem, eh? I am guessing it should be customers_default_address_id = 1, not 0. If I login as customer and maually set my primary address, customers_default_address_id is set to 1. Is this value set by code in catalog/create_account.php? Or where would you suggest I look for the code that is setting the value to 0 by default? Thx, C |
|
#6
| |||
| |||
| How many clients do you have already in the system, if its not many it might be an idea to delete the tables, re-import them from the original script installation file, then create a new user with all entries filled, export it, compare it with your list of customers you exported before deleting the table and look for the mistakes. Then manually update the address book sql and re-import it. least thats what I woudl do to it |
|
#7
| ||||
| ||||
| The problem stems from the old structure of the address_book table. In older versions, the primary key was different and indexes were different than the new structure. Because of this difference, the address book ID was 1 for all the addresses in the old table structure, but the number needs to be unique in the new strucutre. Since the customers table also used the 1 value, they need to be matched with the new value in the address_book table. It is a pain in the rear, since each customer can have more than one address book ID, you need to eliminate the extra addressbook ids in the address_book table for each customer. Once you have a pared down list of addressbook_id's then you need to match that to the customer table, matching up the correct address book ids to the customer id's. Actually, once you remove the extra address entries per customer, they synch right up. Take a look at the tables as you read this, and it should start to make more sense to you (as reading it alone looks pretty much like gibberish). It is a rather painstaking process, but it works. I have done it quite a few times and you will end up with a usable admin panel again. Good luck to you.
__________________ Michael Sasek osCMax Developer
|
|
#8
| ||||
| ||||
| Hey, thanks for the input. I see what you're saying for sync'ing up existing customers and default addresses. Just to clarify, is it the two fields I mentioned above that need to match? I think so. Please confirm. Code: address_book.address_book_id = customers.customers_default_address_id My bigger problem still remains. When NEW customers create a new account and enter an address during registration, it is by default set to 0 in the field "customers_default_address_id". How do I fix this to be 1? I thought it would be in the UPDATE statement in the file catalog/create_account.php. Is it? Or is it a database issue? Here's the statement on line 263: Code: tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
Lastly, what did you mean in reference to the "usable admin panel"? As far as I can tell, there are no issues in the admin panel with customer addresses. Is that possible? Thx, C P.S. I did just try creating a new customer account from the Admin panel and it did the same thing, set customers_default_address_id = 0. |
|
#9
| ||||
| ||||
| msasek, when you say address_book_id needs to be unique, i guess you're saying it needs to match the customers_id... is that right? I have been focusing on values 1, 2, etc. for address_book_id and I guess that's the problem... ugh. So, in the address_book table, I need to renumber all values for address_book_id for ALL customers to match customers_id? "Pain in the rear" does not begin to describe it. ;-\ For example, in the address_book table, customers_id = 543 needs to have address_book_id = 543? Please confirm before I go and do this. I tried renumbering one customer manually in the database and it did not seem to work... Also, is it irrelevant what customers.customers_default_address_id is set to? As I mentioned, it seems to default to 0 and then change to 1 when I login as customer as manually set my primary address. Call me dense, but I need more detailed instructions from you. Your time responding on this one is hugely appreciated... C |
|
#10
| |||
| |||
| What is a little weird is that I imported all the database info from a stock OSC shop with around 65 customers, and when I did tis I had no issue with the address display. Having seen the standard OSC database address book table of yours Chris, it does not look the same as the osc one I had. My osc one had unique numbers for each address book entry, and where there was more than one address for a client the number would increment but the client id would always remain the same, as expected. Your stock osc file had all 1's and 2's for each address book id, so importing this into oscmax would leave you with the exact same problem, as you now have. Getting the address book id to increment is not a challenge, what will be is making sure that the numbers are correct for each customer. Do you have an old backup database file in the old osc file, one that does not have as many clients in it, so I can look at this for you |
| Sponsored Links | ||
| ||
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| customer address required only | ogilirca | osCMax v2 Customization/Mods | 4 | 01-02-2007 10:24 AM |
| Create Customer Account Address Questions | joanstead | osCMax v2 Features Discussion | 0 | 02-16-2006 06:31 AM |
| After account is created - user is not taken to payment page | Goweb | osCMax v2 Installation issues | 2 | 01-01-2006 09:58 AM |
| Email not sent after new customer account is created. | Dumb_Question | osCMax v2 Installation issues | 7 | 12-16-2005 04:37 PM |
| primary address doesn't show | gmartini42 | osCMax v1.7 Discussion | 2 | 02-06-2005 04:56 PM |