Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Accounts are not setting up addresses properly


Guest

Recommended Posts

Every time my customers set up an account the customers_default_address_id is being set to 0 and it should be set to 1 by default.

 

This problem is basically making it so none of my customers can place orders until I go in and manually change this flag to 1 then everything works properly.

 

Has someone identified the error in the code that is setting this flag incorrectly?

Link to comment
Share on other sites

This isn't a count flag this is a flag to indicate the default address; for some reason it is being set to 0 even though the code appears to clearly indicate it should be being set to 1. Additionally the default for that field in the DB is also 1 but it is still being set to zero.

 

When the field is zero the customer's address will not work properly, the customer can not modify or correct the address and the UPS module fails preventing check out. If I manually go in and set the field to 1 then everything is OK.

 

No one else has encougher this problem where "customers_default_address_id" is being improperly set during account set up???

Link to comment
Share on other sites

Something is going awry in this part of the code:

 

tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

 

$address_id = tep_db_insert_id();

 

tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

 

tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

 

if (SESSION_RECREATE == 'True') {

tep_session_recreate();

}

 

$customer_first_name = $firstname;

$customer_default_address_id = $address_id;

 

I saw somewhere else where the person hard coded $address_id as 1 instead of a variable, that just doesn't seem like the proper solution what is the correct code? What does "$address_id = tep_db_insert_id();" do and why is it not setting to 1 when an account is created?

Link to comment
Share on other sites

mine says

[/code]

tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

 

$address_id = tep_db_insert_id();

 

tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

 

tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

 

if (SESSION_RECREATE == 'True') {

tep_session_recreate();

}

 

$customer_first_name = $firstname;

$customer_default_address_id = $address_id;

 

 

 

 

can you see it mine is fine i belive

Vertical Climb watch me loose grip an plumit!!

Link to comment
Share on other sites

I see no difference, I am no programmer so it must not be the php code I wonder if it is the DB setup and the php code is not getting the right response from the db then.

 

I have no contribs so I am working with the as issued code.

Link to comment
Share on other sites

i would say your getting close sounds to me like a restore is in order of the db?

 

thats if you got one that you backed up

btw have you used any contributions?

that may have aided this error

Vertical Climb watch me loose grip an plumit!!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...