Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Enable Flat Rate/Disable Zone over certain amount

Enable Flat Rate/Disable Zone over certain amount

Locked

Views: 2,019

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
19 Jun 2009, 2:04 AM
#1
mommyslilmonkey avatar

mommyslilmonkey

New Zenner

Join Date:
Feb 2009
Posts:
4
Plugin Contributions:
0

Enable Flat Rate/Disable Zone over certain amount

I have been searching the posts and trying to adapt different methods that people have suggested, but it's not working out for me. I'm a total newbie to php.

I want to have a shipping special... $10 flat rate for orders over $40. So basically I want to enable Flat rate shipping for only orders over $40, and disable Zone shipping (which I currently use)... so for orders under $40 still only offer zone shipping.

Can anyone help?

19 Jun 2009, 7:45 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Enable Flat Rate/Disable Zone over certain amount

You can do that with fairly simple editing of both the flat rate and zones shipping modules.

For the flat rate module, edit includes/modules/shipping/flat.php

replace this line of code (line 78):

    return $this->quotes;

with this:

      if($_SESSION['cart']->show_total() >= 40) {
        return $this->quotes;
	  } else {
		return false;
	  }

Now do a similar edit to includes/modules/shipping/zones.php, this time replacing line 254:

      return $this->quotes;

with ```php
if($_SESSION['cart']->show_total() < 40) {
return $this->quotes;
} else {
return false;
}

You could also replace the value 40 in each of those edits with a configuration value - then you'd be able to edit the cost point between the modules from the admin panel instead of editing the code again.

Neville
An assumption is what you arrive at when you get tired of thinking...

20 Jun 2009, 4:12 PM
#3
mommyslilmonkey avatar

mommyslilmonkey

New Zenner

Join Date:
Feb 2009
Posts:
4
Plugin Contributions:
0

Re: Enable Flat Rate/Disable Zone over certain amount

FANTASTIC!!! That worked perfectly. Thank you ever so much!! :smile:

21 May 2010, 7:50 AM
#4
scott_c avatar

scott_c

Zen Follower

Join Date:
Dec 2009
Posts:
236
Plugin Contributions:
0

Re: Enable Flat Rate/Disable Zone over certain amount

Thanks for this code, works great.

I just wanted to add, if you still want to be able to edit your shipping module in the Admin you need to add this code;

!IS_ADMIN_FLAG

So the updated code would be;

    return $this->quotes;

with this:

      if(!IS_ADMIN_FLAG && $_SESSION['cart']->show_total() >= 40) {
        return $this->quotes;
	  } else {
		return false;
	  }

Now do a similar edit to includes/modules/shipping/zones.php, this time replacing line 254:

      return $this->quotes;

with ```php
if(!IS_ADMIN_FLAG && $_SESSION['cart']->show_total() < 40) {
return $this->quotes;
} else {
return false;
}

Cheers,

Scott.

Donation made. Enjoy those donuts! :-)