About Club osCommerce

Showcasing osCommerce…the good, the bad and the ugly!

StumbleUpon It! DIGG It!

Expedite Fee in osCommerce

Written By Gary on Dec 14 2009 · Comments (5)

Buy Gary A Beer?
Buying me a "beer" helps me to keep my contributions updated and keep this blog alive - and you get a link from my homepage to your site. Cheers!


So, you might want to charge an extra amount for shipping "expedited" - especially in the run up to Christmas. At the osCommerce forum someone asked for such, and a number of ideas came up. There are some close contributions, eg "gift wrap" (renamed appropriately of course).

My idea was to simply make a copy of the "low order fee" order_total module, and use that. I guesstimated that it would take 10 extra lines of code, so let's see...

What do we need to do?

1. Add in a checkbox on checkout_shipping.php

PHP:
  1. <?php echo tep_draw_checkbox_field('expedite_fee'); ?> <?php echo sprintf(TEXT_EXPEDITE, $currencies->format(MODULE_ORDER_TOTAL_EXPEDITEFEE_FEE)); ?>

2. Add in processing on checkout_shipping.php

PHP:
  1. if(!empty($HTTP_POST_VARS['expedite_fee'])) tep_session_register('expedite_fee');

3. Destroy the session in checkout_process.php

PHP:
  1. tep_session_unregister('expedite_fee');

4. Copy /includes/modules/order_total/ot_loworderfee.php

Open up the file and change ALL instances of "loworderfee" to "expeditefee"
Also change ALL instances of "LOWORDERFEE" to "EXPEDITEFEE"
Also change all instances of "low order" or "Low Order" to "Expedite"

Change this line from:

PHP:
  1. if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) <MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {

To:

PHP:
  1. if (($pass == true) && (tep_session_is_registered('expedite_fee'))){

Save the file as expeditefee.php

5. Copy the Language File /includes/languages/english/modules/order_total/ot_loworderfee.php

Open up the file and change ALL instances of "loworderfee" to "expeditefee"
Also change ALL instances of "LOWORDERFEE" to "EXPEDITEFEE"
Also change all instances of "low order" or "Low Order" to "Expedite"

Save the file as expeditefee.php

6. Language addition in /includes/languages/english/checkout_shipping.php
Add this:

PHP:
  1. define('TEXT_EXPEDITE', 'Tick this box to expedite your order, costs an extra %s');

7. Admin

Go to your shop admin and turn on the new order total module. Give it a unique sort order and make it show underneath the usual shipping charges.

DONE! This took 10 minutes, and consisted of mainly copy/paste code changes of words, along with three new lines of code (obviously I don't count a simple word change in an existing lline of code as something that is new.

5 Comments

  1. Now have a different version of this on a per shipping module basis, rather than on an overall basis. Thus you might want to charge an extra £5 for expediting flat rate, but only an extra $3 for expediting Table rate. Contact me for costings/details.

    Comment by Gary — April 1, 2010 @ 8:19 am


  2. [...] while back I posted about a solution to add an expedite fee. It works well, but is available on a per checkout basis rather than on a per shipping method [...]

    Pingback by Club osCommerce » Expedite Fee Per Shipping Method — April 13, 2010 @ 8:29 am


  3. hi, i followed all steps, but it is not showing in shipping modules, also i am not even getting
    any error after adding all this, please advise

    Comment by zegar — June 11, 2010 @ 5:06 pm


  4. Add in a checkbox on checkout_shipping.php

    where in this page would this insert be placed?

    Comment by Alex — July 29, 2010 @ 3:49 pm


  5. Anywhere you wish – where-ever it fits best in your theme/template code.

    Comment by Gary — July 30, 2010 @ 8:49 am


Leave a comment

RSS feed for comments on this post · TrackBack URL

Hot 100 osCommerce Shops

View the osCommerce HOT 100These are the best looking, most exceptional osCommerce Stores as voted for by you.

New to osCommerce - get inspiration from these beautiful shops. Reckon your site has what it takes to become a member of the HOT 100? Submit it!