Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

if no shipping method has been selected DO NOT CONTINUE


googly

Recommended Posts

I only allow 1 type of shipping for my country, for the rest of the world I do not allow any shipping because we don't ship to these countries. I present a message to make this clear on (checkout_shipping.php). But when you press CONTINUE it goes successfully onto the payment page even if you have no method to select.

 

On the payment page (checkout_payment.php) if you haven't selected or do not have a payment method available it displays a warning message at the top of the page and doesn't allow you to carry on. This is what I need for my checkout_shipping.php page.

 

I see in the code on checkout_payment.php that there seems to be something in place for this but it isn't working. Can anyone help?

 

// if no shipping method has been selected, redirect the customer to the shipping method selection page

if (!tep_session_is_registered('shipping')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

Link to comment
Share on other sites

you can check the country code w/ this:

$order->delivery['country_id']

find the code for your country (either through admin, or from the datbase w/ phpMyAdmin or such)

 

to not let them continue you can put a check down near the bottom of checkout_shipping.php, look for

<?php echo tep_image_submit('button_continue.gif, IMAGE_BUTTON_CONTINUE);?>

so say your country is 75, change the above to:

<?php if ($order->delivery['country_id'] == '75'){
echo tep_image_submit('button_continue.gif, IMAGE_BUTTON_CONTINUE);
}

this will only show the Continue button if the order is being delivered in your country. You can also adjust the checkout_payment.php page also/instead. Up near the top (maybe the first thing..) just add:

 if ($order->delivery['country_id'] != '75'){
 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING,'','SSL'));
}

this way anyone who does get to this page somehow with the wrong country code, will automatically be redirected back to the shipping page.

 

this is along the lines of what I did on a couple stores because they don't ship posters outside the US. I put a warning on the shipping page, and if they still hit continue the checkout_payment page did the above redirect after removing all posters from their cart first.

Link to comment
Share on other sites

Great - thanks a lot for the advice jefs.42 it's helped me think more about it.

 

I put your suggestion into action and it worked which is always good!

 

I thought that it would be good if it related more to whether there are any shipping methods to choose from though. So instead of

if ($order->delivery['country_id'] == '222'){

I added

if(sizeof($quotes) > 0 && sizeof($quotes[0]) > 0){

which should only show the continue button if there are shipping methods to choose from (I think!)

 

Thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...