Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to split Adress Book?


ultras.nick

Recommended Posts

Hello

 

I'm trying to split my Adress_book into Adress_book for shippments and Adress_book for payments.

 

This is what I did:

 

1. createad new Adress_book table called 'Adress_book2' and renamed the field 'adress_book_id' into 'adress_book_id2' for it.

2. replaced in 'checkout_payment_adress.php' where I found 'TABLE_ADDRESS_BOOK' with 'TABLE_ADDRESS_BOOK2'.

3. added 'define('TABLE_ADDRESS_BOOK2', 'address_book2');' in 'includes\database_tables.php'

4. replaced also in checkout_payment_adress.php - 'adress_book_id' with 'adress_book_id2'

 

What works: The entries for Adress Book 2 are showned correctly. I can add new entries in Adress Book 2.

 

What does not work (and the most important): When I select any of the payment adresses - at the 2nd step of Checkout Process - My shop always selects by default the primary address from original Adress Book :( - ignoring my selection from Adress Book2.

 

Please help.

 

Thanks a lot.

Link to comment
Share on other sites

This is how does a part of my checkout_payment_address.php looks:

 

// process the selected billing destination
} elseif (isset($HTTP_POST_VARS['address2'])) {
  $reset_payment = false;
  if (tep_session_is_registered('billto')) {
	if ($billto != $HTTP_POST_VARS['address2']) {
	  if (tep_session_is_registered('payment')) {
		$reset_payment = true;
	  }
	}
  } else {
	tep_session_register('billto');
  }

  $billto = $HTTP_POST_VARS['address2'];

  $check_address_query2 = tep_db_query("select count(*) as total2 from " . TABLE_ADDRESS_BOOK2 . " where customers_id = '" . $customer_id . "' and address_book_id2 = '" . $billto . "'");
  $check_address2 = tep_db_fetch_array($check_address_query2);

  if ($check_address2['total2'] == '1') {
	if ($reset_payment == true) tep_session_unregister('payment');
	tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
  } else {
	tep_session_unregister('billto');
  }
// no addresses to select from - customer decided to keep the current assigned address
} else {
  if (!tep_session_is_registered('billto')) tep_session_register('billto');
$billto = $customer_default_address_id;

  tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}
 }

// if no billing destination address was selected, use their own address as default
 if (!tep_session_is_registered('billto')) {
$billto = $customer_default_address_id;
 }

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL'));

 $addresses_count2 = tep_count_customer_address_book_entries2();
?>

 

Can someone help? I think I miss something or simply the splitting is not possible...

 

Thanks.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...