OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: Skip checkout_shipping and checkout_payment
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Tips and Tricks
boxtel
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'));
}
hutt5
I tried this and it's not working for me...
When I click on Checkout, I get "page can not be displayed" for checkout_shipping.php.

Any ideas??

Thanks,
Lauren
enigma1
and what happens when someone uses a single credit card payment gateway? Is it going to loop forever?
streetflossin
Just wondering anyone got this working?
jasper12
I've tried the skip checkout_payment.php (just another click that I don't need) and it works beautifully - right on cue as I was about to ask someone how to do it. Many thanks!!!!!
streetflossin
still dont work for me
indianking
works like a charm. A Zillion thanks to you.
jdvb
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.
boxtel
thumbsup.gif
aharpur
QUOTE (boxtel @ Feb 4 2006, 08:33 AM) *
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
boxtel
QUOTE (aharpur @ Dec 11 2006, 01:07 AM) *
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.
aharpur
QUOTE (boxtel @ Dec 10 2006, 05:19 PM) *
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
Phalen
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) ) {
theantiquestore
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.

CODE
/ 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'));
}
digilee
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?
magicmycote
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.
magicmycote
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).
navyhost
QUOTE (Phalen @ Jan 16 2007, 08:31 AM) *
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
puggybelle
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:

CODE
// 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

CODE
// 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
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.