Different pre-selected address in checkout process - OSC

Discussion in 'PHP' started by redrum, Dec 23, 2011.

  1. #1
    I use osCommerce and all customers have two address in their address book. They are not able to add or change the address in thier accoount.

    I try to make the customers default address to always be the customers shipping address in the checkout process at checkout_shipping.php.
    And the customers other address to be set to the invoice/billing address in the checkout process at checkout_payment.php.

    In checkout_payment.php I tried to change
    $billto = $customer_default_address_id;
    to
    $billto != $customer_default_address_id;
    Like this:

    // if no billing destination address was selected, use the customers own address as default
    if (!tep_session_is_registered('billto')) {
    tep_session_register('billto');
    $billto = $customer_default_address_id;
    } else {
    // verify the selected billing address
    if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {
    $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");
    $check_address = tep_db_fetch_array($check_address_query);

    if ($check_address['total'] != '1') {
    $billto = $customer_default_address_id;
    if (tep_session_is_registered('payment')) tep_session_unregister('payment');
    }

    to

    // if no billing destination address was selected, use the customers own address as default
    if (!tep_session_is_registered('billto')) {
    tep_session_register('billto');
    $billto != $customer_default_address_id;
    } else {
    // verify the selected billing address
    if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {
    $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");
    $check_address = tep_db_fetch_array($check_address_query);

    if ($check_address['total'] != '1') {
    $billto != $customer_default_address_id;
    if (tep_session_is_registered('payment')) tep_session_unregister('payment');
    }


    All that happens on checkout_payment.php is that the billing address doesent get displayed at all.

    Can anyone help me and tell me how to make it work like a want to.
     
    redrum, Dec 23, 2011 IP