Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to set default shipping option?


GraphicsGuy

Recommended Posts

I am setting up real time quote modules for UPS, FedEx and USPS. By default, the shipping portion of osCommerce selects the lowest cost method.

 

For my situation, I wish to have it always default to UPS Ground.

 

Does anybody know a way to accomplish this or where the code is located that is making this selection?

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

I found the line of code performing the automatic selection.

 

Line 145 in checkout_shipping.php

 

if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_mod$

 

I commented it out and tested the cart. All looks fine. I would still like to have it default to UPS Ground, but will settle for no automatic selection.

 

When I have more time I will play with it more to default it to UPS Ground and post it here.

 

But if anyone else has accomplished this already, please reply with the edit needed.

 

Thanks.

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

Hi GraphicsGuy

 

in includes/classes/shipping.php on line 128

 

        $cheapest = false;
       for ($i=0, $n=sizeof($rates); $i<$n; $i++) {
         if (is_array($cheapest)) {
           if ($rates[$i]['cost'] < $cheapest['cost']) {
             $cheapest = $rates[$i];
           }
         } else {
           $cheapest = $rates[$i];

 

just change the < to a > thus making the code:

 

        $cheapest = false;
       for ($i=0, $n=sizeof($rates); $i<$n; $i++) {
         if (is_array($cheapest)) {
           if ($rates[$i]['cost'] > $cheapest['cost']) {
             $cheapest = $rates[$i];
           }
         } else {
           $cheapest = $rates[$i];

 

Hey presto it works ;)

Link to comment
Share on other sites

Thanks Jamsy.

 

Actually that casues it to default to the most expensive option. But it did identify some more code that I might experiment with when I can take the time.

 

I am sure that once I dig into the variables involved, it will be possible to make it default to UPS Ground.

 

I am new to osCommerce and to this forum. I am impressed with the structure and versatility of osCommerce and with the helpful, friendly nature of this forum. I look forward to getting to the point of being able to contribute.

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...