Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Stop choosing cheapest shipping method


SamyT

Recommended Posts

I'm implementing a $0.50 payment method for use under strict circumstances, however when I put this in place the shipping page always defaults to this choice... is there any way to stop it from doing this?

 

I see in the code:

$shipping = $shipping_modules->cheapest();

 

Does anyone know if it's this bit of code that needs changing and what I can change it to so it stops defaulting to the cheapest shipping method.

Link to comment
Share on other sites

I'm implementing a $0.50 payment method for use under strict circumstances, however when I put this in place the shipping page always defaults to this choice... is there any way to stop it from doing this?

 

I see in the code:

Does anyone know if it's this bit of code that needs changing and what I can change it to so it stops defaulting to the cheapest shipping method.

If you want a complete hack

in catalog\includes\classes\shipping.php

change

if ($rates[$i]['cost'] < $cheapest['cost']) {

to

if ($rates[$i]['cost'] > $cheapest['cost']) {

 

at around line 122

Link to comment
Share on other sites

  • 4 weeks later...

You can also pick the rate you want to preselect by choosing the position in the array.

 

catalog\includes\classes\shipping.php

 

if ($rates[$i]['cost'] < $cheapest['cost']) {

 

add >> $xi = 0; // or $xi = $i - 1;

change>> $cheapest = $rates[$xi];

}

 

the shipping price array follows the radio buttons on the shipping checkout page from top to bottom.

example if you have table rate as your first choice then that is array value 0 ($xi = 0;).

If you want the next to last value in the array (which may be the lowest of 7 UPS rates returned)

then you want $xi = $i - 1

 

This will be come more complex based on the shipping choices you sellect and the order you put them in.

Link to comment
Share on other sites

  • 4 months later...

Archived

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

×
×
  • Create New...