Streamline your checkout process in osCommerce
multimixer | learn | Saturday June 23 2012There are many cases where the visitor get just one shipping or payment option presented. This can be the case if you have just one shipping or payment module enabled or it can be that you have conditions for your shipping and payment ways: In this case a visitor from UK will get just one shipping or payment option while a visitor from the USA 3 of them.
In any case, it makes no sense to let people navigate through pages where there is nothing to select and no information presented. All your visitors can do in such a case is to press the “continue” button, and this is something the system can do automatically
In this way, you can cut of 2 of the 4 checkout steps and that’s a huge improvement. People will be transfered directly from the shopping cart page to the checkout confirmation page. Please note, that it case you enable a second shipping or payment module, the page will appear again by it self
The tip presented here comes from the “tip and trick” section of the osCommerce forum, to the topic there I contributed my self, unfortunately it’s getting lost in the crowd and I thing it’s worth to have it clearly presented. Like each forum post, it evolved over the time.
Lets start, things are easy, you’ll need just to copy paste
The files you’ll be working on are
- catalog/checkout_shipping.php
- catalog/checkout_payment.php
Make a copy of that files and store them somewhere on your computer, in that way you’ll be able to get back to the previous status in case you mess up
1. checkout_shipping.php
open the file and find following line, it’s number 97 in a default file
// process the selected shipping method
Add just before following
// 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']); $shipping = $shipping_modules->cheapest(); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); }
Done !
2. checkout_payment.php
Open the file and find following line, it’s number 81 in a default file
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);
Add just before
// skip if only 1 payment method available $payment_module_selections = $payment_modules->selection(); if (sizeof($payment_module_selections) <= 1) { if (!tep_session_is_registered('payment')) tep_session_register('payment'); $payment = $payment_module_selections[0]['id']; tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL')); }
Done !
Mini template system users, you can do exactly the same if your want, your files are identical to the default osCommerce version
Thats all people, try it out
All credits to the original posters at the osCommerce forum
Thank you for all the work you put into helping people with OSCommerce! I have learnt a lot. I just have one issue with this code. It skips the shipping and payments pages as it should, but the shipping cost is not included in the total due. The only payment module I have installed is Paypal express checkout and the shipping is based on two flat rates (one for international addresses and one for domestic addresses). Do you know what might be causing this? Thank you.
@Duncan, I will check this and post back here
thanks ur code worked a lot
I’m busy designing a website and would like to find out how i would go about extending my cart to allow for option addons with pickture to a product.
i’m busy with a custom shirt shop and it needs to ability to add various elements like a colar form a list of options and allowing the customer to add measurements of his neck into the cart can you assist please.
Hello multimixer,
I have same issue that Duncan has. Please provide the solution if you can.
I have free shipping for total amount above $300. But now I need to have other shipping options (Say UPS 2D and 3D) along with free shipping. I have changed the code in checkout_shipping.php file to display other shipping methods along with free shipping when total amount exceeds $300.
But the issue is that, the shipping charges are not getting applied when customer selects any of UPS 2D Or 3D shipping methods. Its always consider free shipping and does not display any shipping charges at peypal.
Is there any other file where I need to look out for free shipping condition.
Please help me to get out of this issue I have spend lot of time to resolve the same and now stuck up :(.
Your early response will be appreciated.
Thanks in advance.
@sandip
The moment you have more than 1 shipping method, there is no skipping of the shipping page any more: Page display normally, all shipping options display on the page, customer can select
Your issue seem to be a general shipping problem, don’t know what changes you did to checkout_shipping.php, I would suggest to post your issue to the forum together with your modified code
Dear George,
Thank you for your tutorials. I like and learn a lot from your posted tutorials. I am looking for the tutorials to add zones for shipping in the box of “Location / Taxes” of admin panel on the oscommerce 2.3.3, could you help it
currently in the “location / taxes” box only have : countries, zones, tax zones, tax classes, tax rates, but none for shipping zone
For local shipping in Indonesia most of the shipping provider based the shipping cost until sub-zones which almost equal to zip code zones.
Could you please post tips or information or tutorials for this case? Thank you
Yes, probably I could make a separate post about this
The term “tax zones” is a bit misleading, the settings you do there are not just about taxes
You can set up as many “tax zones” as you like and use them e.g. for shipping or payment or anything else.
You could e.g., create 3 new tax zones, call them “”close”, “far”, “very far”, add any geographical zones to them and use that zones for the shipping modules only
George,
I am learning so much from your posts. Thank you so much for taking the time and documenting everything so thoroughly. I just wanted you to know people are still reading your posts and learning from your excellent turtorials!
Shane
Hi Multimixer,
Thank you very much for the input on the OsCommerce shopping cart and having taken your precious time to the above script together!
It has solved a HUGE CHALLENGE that I had for several days.
If you ever plan on coming to Kenya on holiday or business, please drop me an email through sales@tomasiholidaysafrica.com and I will be more than glad to share a cup of coffee or a glass or wine!
I sincerely mean it Multimixer.
Warmest regards
Tom Njiri
TOMASI Holidays Africa
http://www.tomasiholidaysafrica.com
+254727247100