Jump to content



Latest News: (loading..)

- - - - -

Set/Change default shipping method


This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1   GemRock

GemRock
  • Members
  • 2,074 posts

Posted 16 December 2007 - 09:56 PM

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

markg@dpie.com
  • Members
  • 292 posts

Posted 05 June 2008 - 09:28 AM

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

flowremedies
  • Members
  • 3 posts

Posted 14 August 2008 - 01:11 PM

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

chingali
  • Members
  • 120 posts

Posted 12 September 2008 - 12:24 AM

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

ramzog
  • Members
  • 12 posts

Posted 05 May 2009 - 12:38 AM

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

cinolas
  • Members
  • 73 posts

Posted 29 June 2011 - 07:26 PM

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.

#7   ZiSMO

ZiSMO
  • Members
  • 1 posts

Posted 24 May 2012 - 06:26 PM

Does anybody know how to change my flat rate shipping from 4.99 to 2.50?