Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2008
    Posts
    8
    Plugin Contributions
    0

    Default unable to disable flat rate with maximum weight

    I have been trying to disable the flat rate shipping module when the weight is over 2 lbs
    Here is my code


    class flat {
    var $code, $title, $description, $icon, $enabled;

    // class constructor
    function flat() {
    global $order, $db , $shipping_weight ;

    $this->code = 'flat';
    $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_FLAT_TAX_BASIS;

    // maximum Shipping Weight: If the shipping weight more than 2lb disable the module
    if ($shipping_weight < 2) {
    $this->enabled = false;
    }

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: unable to disable flat rate with maximum weight

    What is this code yeilding?
    What file are you hacking it into?
    What version of ZC are you working with?
    What ver of php?
    What version of mysql?
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: unable to disable flat rate with maximum weight

    You said you do NOT want Flat Rate flat when shipping weight is > 2 ...

    But, your code has this written backwards:
    Code:
    // maximum Shipping Weight: If the shipping weight more than 2lb disable the module
    if ($shipping_weight < 2) {
    $this->enabled = false;
    }
    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: v1.5.5]
    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!

  4. #4
    Join Date
    Jul 2008
    Posts
    8
    Plugin Contributions
    0

    Default Re: unable to disable flat rate with maximum weight

    Hey Kobra
    This is the flat rate module. I am using version 1.3.8. I have the newest php and mysql.

    The code is not deactivating it for any shipping weight. I have changed it to >2 and the same issues are coming up.
    I thought this was the correct code. I am wondering if I calling for the wrong weight? I have tried $total_weight and $shipping_weight.
    Thanks

  5. #5
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: unable to disable flat rate with maximum weight

    What are you doing when the weight is over 2 pounds?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: unable to disable flat rate with maximum weight

    Depending upon the answer you have to Kim's question - - You might use the table rate module and set your table

    Code:
    Shipping Table
    2:Your_rate,10000:0.00 or???
    
    Table Method
    weight
    Zen-Venom Get Bitten

  7. #7
    Join Date
    Jul 2008
    Posts
    8
    Plugin Contributions
    0

    Default Re: unable to disable flat rate with maximum weight

    When it goes over 2 pounds it is done by UPS rates only. The UPS rates are always displayed but I don't want the flat rate displayed when under 2 lbs

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: unable to disable flat rate with maximum weight

    To be safe and ensure that you have accounted for the Tare Rate, just change the function quote to read:
    Code:
    // class methods
        function quote($method = '') {
          global $order;
    
    // don't show when weight < 2
          $this->quote = array();
          $check_order_weight = round($_SESSION['cart']->show_weight(),9);
          if ($check_order_weight < 2) {
            $this->enabled = false;
          }
    
          if ($this->enabled) {
            $this->quotes = array('id' => $this->code,
                                  'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                                  'methods' => array(array('id' => $this->code,
                                                           'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                           'cost' => MODULE_SHIPPING_FLAT_COST)));
            if ($this->tax_class > 0) {
              $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
            }
    
            if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
          }
          return $this->quotes;
        }
    If you do not want to use the Tare rate as part of this, then customize the code in the function flat and just before the closing bracket of the function add:
    Code:
    // don't show when weight < 2
          global $shipping_weight;
          $check_order_weight = $shipping_weight;
          if ($check_order_weight < 2) {
            $this->enabled = false;
          }
    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: v1.5.5]
    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!

 

 

Similar Threads

  1. Maximum weight for flat rate
    By mahlerosa in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 25 Jan 2012, 07:41 AM
  2. Disable Flat rate after weight of cart is over a certain amoun
    By brettw in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 7 Mar 2009, 08:38 PM
  3. Disable flat rate per item?
    By kbrand in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 9 Aug 2006, 07:41 PM
  4. Disable flat rate for international?
    By capoeiramart in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 1 Jun 2006, 05:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR