Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Skip checkout_shipping and checkout_payment


boxtel

Recommended Posts

Skip checkout_shipping and checkout_payment if they have only 1 option for selection.

 

 

checkout_shipping.php:

 

just before:

 

// process the selected shipping method

 

add:

 

// bypass if only 1 shipping method available or free shipping

if ( (tep_count_shipping_modules() == 1) || ($free_shipping == true) ) {

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

if ($free_shipping) {

$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;

$quote[0]['methods'][0]['cost'] = '0';

} else {

$quote = $shipping_modules->quote($method, $module);

}

$shipping = array('id' => $shipping,

'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),

'cost' => $quote[0]['methods'][0]['cost']);

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

}

 

 

checkout_payment.php:

 

just before:

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

 

add:

 

// skip if only 1 payment method available

if (tep_count_payment_modules() == 1) {

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

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

}

Treasurer MFC

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
  • 3 weeks later...
  • 1 month later...
  • 2 months later...

nice solution you chose,

I skipped the page altogether and set the checkout_payment.php to let you choose shipping address and billing address. But then I do have two payment choices, so that page I need all together.

My header link to checkout now points to checkout_payment.php, as does the shopping cart.

and I altered checkout_payment.php to include the default shipping method.

this solution is more simple, but does have one disadvantage. on the process trail below the links are still displayed that two steps have been completed. The first of those I removed as well.

Link to comment
Share on other sites

  • 3 weeks later...
Skip checkout_shipping and checkout_payment if they have only 1 option for selection.

checkout_shipping.php:

 

just before:

 

// process the selected shipping method

 

add:

 

// bypass if only 1 shipping method available or free shipping

if ( (tep_count_shipping_modules() == 1) || ($free_shipping == true) ) {

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

if ($free_shipping) {

$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;

$quote[0]['methods'][0]['cost'] = '0';

} else {

$quote = $shipping_modules->quote($method, $module);

}

$shipping = array('id' => $shipping,

'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),

'cost' => $quote[0]['methods'][0]['cost']);

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

}

checkout_payment.php:

 

just before:

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

 

add:

 

// skip if only 1 payment method available

if (tep_count_payment_modules() == 1) {

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

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

}

 

 

Thanks, Amanda,

 

I have used your modification to skip the checkout_payment page. I encountered just one little snag.

I had two payment modules installed, PayPal IPN and the standard PayPal module. I had disabled the latter and so had only one payment choice offered to the customer.

 

When I applied your mod, after clicking Continue on the Delivery Information page, nothing happened. Instead of going straight to Checkout Confirmation, operation seemed to get stuck in a loop.

 

I then removing the standard PayPal module instead of just disabling it and all was well. This is not a problem. I don't need the standard module and I can easily re-install it if I ever do.

 

I haven't tried skipping the delivery page. I wonder if the same point applies here too? That is, that the mod needs to have only one option installed rather than just one enabled.

 

Tony

Link to comment
Share on other sites

Thanks, Amanda,

 

I have used your modification to skip the checkout_payment page. I encountered just one little snag.

I had two payment modules installed, PayPal IPN and the standard PayPal module. I had disabled the latter and so had only one payment choice offered to the customer.

 

When I applied your mod, after clicking Continue on the Delivery Information page, nothing happened. Instead of going straight to Checkout Confirmation, operation seemed to get stuck in a loop.

 

I then removing the standard PayPal module instead of just disabling it and all was well. This is not a problem. I don't need the standard module and I can easily re-install it if I ever do.

 

I haven't tried skipping the delivery page. I wonder if the same point applies here too? That is, that the mod needs to have only one option installed rather than just one enabled.

 

Tony

 

 

try using this:

 

if (tep_count_payment_modules() < 2 ) {

$payment_select = $payment_modules->selection();

$payment = $payment_select[0]['id'];

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

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

}

 

and as far as I can see, only enabled modules count, not just installed modules.

Treasurer MFC

Link to comment
Share on other sites

try using this:

 

if (tep_count_payment_modules() < 2 ) {

$payment_select = $payment_modules->selection();

$payment = $payment_select[0]['id'];

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

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

}

 

and as far as I can see, only enabled modules count, not just installed modules.

 

I have tested your mod again (both versions) and you are right. The payment info page is correctly skipped whether the unwanted payment module is removed or just disabled. I don't know what caused the glitch I experienced a few days ago. Must have been something else.

I now intend to use your second version (10 Dec).

Thanks

Tony

Link to comment
Share on other sites

  • 1 month later...

great stuff! just wanted to skipp the shipping page, seeing as i dont use that at all - my site is just for magazine subscriptions - so no shipping needed at all.

 

just changed the code slightly:

 

if ( (tep_count_shipping_modules() == 1) || ($free_shipping == true) ) {

 

changed to:

 

if ( (tep_count_shipping_modules() == 0) || ($free_shipping == true) ) {

Link to comment
Share on other sites

  • 1 month later...

I couldnt seem to get it to skip the checkout_payment page to work with the newer google checkout contrib. Since I dont offer any type of shipping options (flat rate on one site, table on another) I just put this code in checkout_shipping.php and didnt put anything in checkout_payment to bypass the whole thing and go straight to the confirmation page.

 

/ bypass if only 1 shipping method available or free shipping
if ( (tep_count_shipping_modules() == 1) || ($free_shipping == true) ) {
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
if ($free_shipping) {
$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
$quote[0]['methods'][0]['cost'] = '0';
} else {
$quote = $shipping_modules->quote($method, $module);
}
$shipping = array('id' => $shipping,
'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
'cost' => $quote[0]['methods'][0]['cost']);
tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
}

Link to comment
Share on other sites

  • 10 months later...

I've just tried to get this working but all I get is

"The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

* This problem can sometimes be caused by disabling or refusing to accept cookies."

 

I have:

Force cookie use - true

SEO URLS

SSL

 

Any clues?

SolarFrenzy

Solar powered gadgets at down to earth prices.

 

CheekyNaughty

Promoting British Design

Link to comment
Share on other sites

  • 3 weeks later...

I applied this edit to my checkout_shipping and checkout_payment (1 shipping option, 1 payment option available). I'm using the Authorize.net module, but when they would enter an incorrect cc#, or a wrong cvv code or any general address error that would cause the order to be declined - the error messages were not being displayed. Instead, the page would refresh and go right back to the checkout_confirmation page. So users would click confirm 5 or 6 times and give up...then check their bank account and sometimes find they were pre-charged 5 or 6 times.

 

I thought people should be aware that this happened to me using spu shipping module, authorize.net payment, and STS.

Link to comment
Share on other sites

Also when this hack is applied, the bottom order status "line" (payment information --- confirmation ---- finished , etc) does not line up (dot is over finished on confirmation page) when used in conjunction with the Authorize.net module (new one).

Link to comment
Share on other sites

  • 2 weeks later...
great stuff! just wanted to skipp the shipping page, seeing as i dont use that at all - my site is just for magazine subscriptions - so no shipping needed at all.

 

just changed the code slightly:

 

if ( (tep_count_shipping_modules() == 1) || ($free_shipping == true) ) {

 

changed to:

 

if ( (tep_count_shipping_modules() == 0) || ($free_shipping == true) ) {

 

The first code I used wasn't skipping but when altering like yourself it worked like a charm. thanks guys

Sincerely

Mike

Link to comment
Share on other sites

  • 2 weeks later...

I have two shipping methods available. Table Rates for the US and Canada...and Zone Rates for other countries.

 

I'm using Amanda's code from her first post. However, I changed the first line from:

 

// bypass if only 1 shipping method available or free shipping
if ( (tep_count_shipping_modules() == 1) || ($free_shipping == true) ) {

 

To this, because I have two shipping methods...just to see what would happen

 

// bypass if only 1 shipping method available or free shipping
if ( (tep_count_shipping_modules() == 2) || ($free_shipping == true) ) {

 

If I login as a customer from the US or Canada and proceed to checkout...it does bypass checkout_shipping and checkout_payment and correctly picks up the calculation for Table Rates as it should.

 

However, if I login as a customer from France...which is set up on the Zone Rates module...it does not bypass the checkout_shipping screen. Any ideas why Table Rate customers do skip the checkout_shipping page but Zone Rate customers do not?

 

Actually, I did change the sort order of the two shipping modules so that they both have a sort order of zero, but it made no difference. Can't seem to get foreign buyers to skip the checkout_shipping screen. No big deal...just wondering why that's happening. I know this code was designed for only one shipping method, so...don't yell at me. LOL. Just playing with it and seeing what happens.

 

Worst case scenario: I can have US and Canada skip 2 steps in checkout and the rest of the planet can skip 1 step. LOL.

 

Also, I use Credit Class Gift Voucher 5.10. The field to enter any discounts is on the checkout_payment page. Can someone steer me to another contrib where, perhaps, the customer could enter a discount code and redeem from their shopping cart screen...or something close to that? I don't mind losing CCGV at all, but I would like the ability to enter a discount code somewhere. Skipping the checkout_payment screen kills that.

 

Andrea

Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...
  • 2 months later...

BOXTEL: thankyou SO much for this (i know you put it up two years ago!!). I spent hours today trying to figure out how to do this. This worked like a charm for me.

 

I've also installed Purchase without account so my checkout process is just two pages now, supreme!

Link to comment
Share on other sites

  • 3 months later...

Any solution for this problem ???

I get this error:

 

"The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

* This problem can sometimes be caused by disabling or refusing to accept cookies."

 

The line that generates the error:

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

Link to comment
Share on other sites

  • 1 month later...

Archived

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

×
×
  • Create New...