Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Little bit of code advice, please


Guest

Recommended Posts

Posted

Hi, folks. I have a little/big problem and would appreciate any help you can give. I'm

almost finished making a very rapid checkout setup on my dev store but there's one little

bit not working.

Since we offer free shipping and we choose the method, I've bypassed the checkout_shipping

page entirely. From login or create_account, the customer is dropped into checkout_payment

where the page is modified to remind about our shipping deal and offer a change address box

(both of these are above the regular payment/payment address boxes)

 

The problem is that the shipping address comes up blank on the checkout_payment page for a

new customer (Just a big blank space and one comma).

If the customer clicks on the change address button, they are redirected to

checkout_shipping_address. The default address shown in the top box is still blank with the

exception of the comma. If they simply click on Continue at the bottom of the page, it sends

them to checkout_payment as expected but this time their default address shows up! (That's

great but it needed to be there the first time)

If they enter an address in the form, it works as expected. They are redirected to

checkout_payment and the new address is loaded properly.

From that point on, for a customer, it always works properly, even future orders.

 

So, I figure there needs to be a snippet of code to register the default address as the

shipping address the first time the customer lands on checkout_payment and I used this up top in the file:

// if no shipping destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('shipping')) {
tep_session_register('sendto');
$sendto = $customer_default_address_id;  
}

But it didn't help.

Can anyone tell me if there's a way to get this to work?

Posted

Perhaps using the session variable like this?

// if no shipping destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('shipping')) {
tep_session_register('sendto');
$sendto = $_SESSION['customer_default_address_id'];  
}

Posted

Interesting you said that because it seems to work fine on one of my computers but not the other. The one is set up differently, I think there's a cookie issue. So, that makes sense to me. I'll substitute your code and try both to see. Thanks for the help!

 

Hey, that works great! Thanks! Oh, by the way, the way I had it working before was to ask about registered sendto because a shipping method never gets registered. Here's the final with your help that is working for me:

// if no shipping destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('sendto')) {
tep_session_register('sendto');
$sendto = $_SESSION['customer_default_address_id']; 
}

Thanks again! This checkout is clean and speedy now!

Archived

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

×
×
  • Create New...