Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I have implemented a contribution to my osCommerce shop, and it forces the customer's shipping address and billing address to match.

 

I need to implement code that forces the shipping address and billing address to be exactly the same - if the customer clicks Change Address and changes to a different address on either the delivery information page or the billing information page, the change is reflected on both pages.

 

My question is, how can I allow an exception? I'd like to allow the customer to be able to change their billing address to include a PO box. IF a PO Box is entered, then the addresses can differ from each other. If a PO Box is not entered, they both need to be the same.

 

PHP developers on EE have mentioned that my syntax needs to look something like this, however I need help writing the code:

 

NOTE: osCommerce defines the shipping address as $sendto, and the billing address as $billto.

 

[ code begin ]

 

take the street address part of the billing address and copy it to another field which will be passed

If $postbox is set, check that it has a valid po box value

If it does, copy the billing address to $billto instead of the $sendto

If it doesn't, copy the $send to $billto

 

If $postbox is NOT set, copy the $send to $billto

 

[ code end ]

 

Can anyone help me write this function? I'm not a great programmer, but I understand it. Also, the current contribution I'm using (http://www.oscommerce.com/community/contributions,3169/category,all/search,billing+address) contains code like:

 

[ same address match code begin ]

 

//BOF Address Match

//$sendto = tep_db_insert_id();

if(REQUIRE_ADDRESS_MATCH == 'false') {

$sendto = tep_db_insert_id();

} else {

$sendto = tep_db_insert_id();

$billto = tep_db_insert_id();

}

//EOF Address Match

 

//BOF Address Match

//$sendto = $HTTP_POST_VARS['address'];

if (!tep_session_is_registered('billto')) tep_session_register('billto');

if(REQUIRE_ADDRESS_MATCH == 'false') {

$sendto = $HTTP_POST_VARS['address'];

} else {

$sendto = $HTTP_POST_VARS['address'];

$sendto = $customer_default_address_id;$billto = $HTTP_POST_VARS['address'];

}

//EOF Address Match

 

[ same address match code end ]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...