osCmax v2.5 User Manual
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

customer primary address not set when new account created?

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

      
  1. #1
    Active Member chrismole's Avatar
    Join Date
    Dec 2003
    Location
    Chicago
    Posts
    102
    Rep Power
    9


    Default customer primary address not set when new account created?

    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

  2. #2
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default RE: customer primary address not set when new account create

    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


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  3. #3
    Active Member chrismole's Avatar
    Join Date
    Dec 2003
    Location
    Chicago
    Posts
    102
    Rep Power
    9


    Default RE: customer primary address not set when new account create

    That's what I was afraid of...

    Any advice on what table(s) to start looking at and for what errors?

    Thx,
    C

  4. #4
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default RE: customer primary address not set when new account create

    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


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  5. #5
    Active Member chrismole's Avatar
    Join Date
    Dec 2003
    Location
    Chicago
    Posts
    102
    Rep Power
    9


    Default RE: customer primary address not set when new account create

    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:
    • address_book: address_book_id
      customers: customers_default_address_id

    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. #6
    Member
    Join Date
    Feb 2006
    Posts
    63
    Rep Power
    0


    Default RE: customer primary address not set when new account create

    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. #7
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default RE: customer primary address not set when new account create

    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


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  8. #8
    Active Member chrismole's Avatar
    Join Date
    Dec 2003
    Location
    Chicago
    Posts
    102
    Rep Power
    9


    Default RE: customer primary address not set when new account create

    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
    I have about 600 existing customers so I think I can get the ids sync'ed ok.

    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 . "'");
    However, I cannot locate a default value for the variable $address_id. In fact, I can't find the variable declared in any file in the catalog folder. Am I on the right track here?

    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. #9
    Active Member chrismole's Avatar
    Join Date
    Dec 2003
    Location
    Chicago
    Posts
    102
    Rep Power
    9


    Default RE: customer primary address not set when new account create

    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. #10
    Member
    Join Date
    Feb 2006
    Posts
    63
    Rep Power
    0


    Default RE: customer primary address not set when new account create

    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

Page 1 of 2 12 LastLast

Similar Threads

  1. customer address required only
    By ogilirca in forum osCmax v2 Customization/Mods
    Replies: 4
    Last Post: 01-02-2007, 10:24 AM
  2. Create Customer Account Address Questions
    By joanstead in forum osCMax v2 Features Discussion
    Replies: 0
    Last Post: 02-16-2006, 06:31 AM
  3. After account is created - user is not taken to payment page
    By Goweb in forum osCmax v2 Installation issues
    Replies: 2
    Last Post: 01-01-2006, 09:58 AM
  4. Email not sent after new customer account is created.
    By Dumb_Question in forum osCmax v2 Installation issues
    Replies: 7
    Last Post: 12-16-2005, 04:37 PM
  5. primary address doesn't show
    By gmartini42 in forum osCmax v1.7 Discussion
    Replies: 2
    Last Post: 02-06-2005, 04:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •