Forums / Code Collaboration / Table Rate enable after certain shopping cart price value?

Table Rate enable after certain shopping cart price value?

Views: 3,176

Results 1 to 4 of 4
2 Apr 2013, 10:09 PM
#1
jmwiley avatar

jmwiley

New Zenner

Join Date:
Apr 2013
Location:
California
Posts:
11
Plugin Contributions:
0

Table Rate enable after certain shopping cart price value?

Is there a way to have the Table Rate module enable after a specified price instead of $0.00 and use a different shipping module until then?

ie. The cart will use a different module, like UPS, FedEx or USPS for amounts from $0.00 to 1,999.99 and will enable "Table Rate" from $2,000.00 +

3 Apr 2013, 3:10 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Table Rate enable after certain shopping cart price value?

You could customize the code for Table Rate by adding the code in RED to the file:
/includes/modules/shipping/table.php

    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
    }

[B]// bof: disable when under $2000.00
    if (!IS_ADMIN_FLAG) {
      $chk_total_less_free_shipping = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices();
//  echo 'Table sees Total: ' . $chk_total_less_free_shipping . '<br>';
      if ($chk_total_less_free_shipping < 2000.00) {
        $this->enabled = false;
      }
    }
// eof: disable when under $2000.00
[/B]
    if ($this->enabled) {
      // check MODULE_SHIPPING_TABLE_HANDLING_METHOD is in

Then, reverse the logic for your other shipping modules to disable them when $chk_total_less_free_shipping >= 2000 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Apr 2013, 3:13 PM
#3
jmwiley avatar

jmwiley

New Zenner

Join Date:
Apr 2013
Location:
California
Posts:
11
Plugin Contributions:
0

Re: Table Rate enable after certain shopping cart price value?

Ajeh,

The code above worked PERFECTLY! It was real easy to implement.

I have yet to try the "$chk_total_less_free_shipping >= 2000" to the other shipping module since it's not live yet, but I'm positive there won't be issues.

THANK YOU!!

8 Apr 2013, 3:16 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Table Rate enable after certain shopping cart price value?

You are most welcome ... thanks for the update that this is working for you ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!