Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Set/Change default shipping method


5 replies to this topic

#1 GemRock

  • Community Member
  • 2,069 posts
  • Real Name:Ken
  • Gender:Male
  • Location:UK

Posted 16 December 2007, 21:56

I know there's a contribution for this, but for those who simply want to set to default a shipping method of his/her choice, which is not the cheapest, then here is a simpler, quicker way of doing it:

1. open [catalog]includes/classes/shipping.php for edit. Look for at around line 112 & 115 these two lines of code:
$cheapest = $rates[$i];
and change both to:
$cheapest = $rates[0];

2. in admin, modules - shipping, give/change the sort order of the shipping method you want to set as default to 1, ie, the top most, or you will need to the '0' in
$rates[0]
as shown above to a number that corresponds to your chosen shipping method's sort order, eg, 1 for sort order 2.

No other change is needed.
Ken
commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).
over 20 years of computer programming experience.

#2 markg@dpie.com

  • Community Member
  • 292 posts
  • Real Name:Mark
  • Gender:Male
  • Location:Kent, UK

Posted 05 June 2008, 09:28

View PostGemRock, on Dec 16 2007, 10:56 PM, said:

I know there's a contribution for this, but for those who simply want to set to default a shipping method of his/her choice, which is not the cheapest, then here is a simpler, quicker way of doing it:

1. open [catalog]includes/classes/shipping.php for edit. Look for at around line 112 & 115 these two lines of code:
$cheapest = $rates[$i];
and change both to:
$cheapest = $rates[0];

2. in admin, modules - shipping, give/change the sort order of the shipping method you want to set as default to 1, ie, the top most, or you will need to the '0' in
$rates[0]
as shown above to a number that corresponds to your chosen shipping method's sort order, eg, 1 for sort order 2.

No other change is needed.
Ken

Was just about to install that contribution as I've just setup a store pickup rate (which then became the default choice as its free - not too great) - you have saved me a lot of time. Thanks!

#3 flowremedies

  • Community Member
  • 3 posts
  • Real Name:Bianca

Posted 14 August 2008, 13:11

Thanks!!! I was digging through the contributions for something to sort my shipping methods, as I had the same problem with the cheapest method. I couldn't really find anything that suited my problem, so I decided to google for tips and stumbled on your post :thumbsup: :thumbsup:

#4 chingali

  • Community Member
  • 120 posts
  • Real Name:Chabooky
  • Location:Australia

Posted 12 September 2008, 00:24

Thank you very much, just what I was looking for.
Always be nice to other people, you never know when you might need something from them...

#5 ramzog

  • Community Member
  • 12 posts
  • Real Name:Carl
  • Location:US, California

Posted 05 May 2009, 00:38

Thank you!

View PostGemRock, on Dec 16 2007, 01:56 PM, said:

I know there's a contribution for this, but for those who simply want to set to default a shipping method of his/her choice, which is not the cheapest, then here is a simpler, quicker way of doing it:

1. open [catalog]includes/classes/shipping.php for edit. Look for at around line 112 & 115 these two lines of code:
$cheapest = $rates[$i];
and change both to:
$cheapest = $rates[0];

2. in admin, modules - shipping, give/change the sort order of the shipping method you want to set as default to 1, ie, the top most, or you will need to the '0' in
$rates[0]
as shown above to a number that corresponds to your chosen shipping method's sort order, eg, 1 for sort order 2.

No other change is needed.
Ken


#6 cinolas

  • Community Member
  • 69 posts
  • Real Name:Nicolas

Posted 29 June 2011, 19:26

Another alternative is to make it so that the cheapest non-free shipping rate is the default by simply changing the IF at line 111

FROM:

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

TO:

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

That's what works best for me, hopefully it'l help others too.