Results 1 to 10 of 18

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Location
    New York
    Posts
    157
    Plugin Contributions
    0

    Default Re: Shipping module setting weight independent of number of items ordered

    I use 0 or zero weight for magazine subscriptions which are always free shipping. Our volume of sale is usually limited to a max of 3 or 4 copies of the same size. The tube weight is set to say .9 pounds. If a person orders 1 or 3 or 12 identical photogrphs I want the net weight to be 0.9 pounds not .9 times the number purchased. The category ID of one such photo is 5015. There four other items which are shipped this way with different IDs. I am using version 1.3.9f planning to upgrade soon.

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

    Default Re: Shipping module setting weight independent of number of items ordered

    You could customize the FREE SHIPPING freeshipper and Flat Rate flat shipping modules ...

    Let's assume the Tube Products are products_id 193, 194, 195 and 196 ...

    Edit the file:
    /includes/modules/shipping/flat.php

    and add the code in red:
    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
          }
    
    // bof: show if products_id 193, 194, 195 or 196 are in the cart
          if (!IS_ADMIN_FLAG) {
            global $cart;
    
            $chk_products_in_cart = 0;
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '192');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '193');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '194');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '195');
    
            $full_count = $_SESSION['cart']->count_contents();
    
            if ($chk_products_in_cart > 0 && $full_count == $chk_products_in_cart) {
              $this->enabled = true;
            } else {
              $this->enabled = false;
            }
          }
    // eof: show if products_id 193, 194, 195 or 196 are in the cart
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
    Then, customize the file:
    /includes/modules/shipping/freeshipper.php

    Code:
          // enable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FREESHIPPER_STATUS == 'True') ? true : false);
          }
    
    // bof: do not show if products_id 193, 194, 195 or 196 are in the cart
          if (!IS_ADMIN_FLAG) {
            global $cart;
    
            $chk_products_in_cart = 0;
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '192');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '193');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '194');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '195');
    
            if ($chk_products_in_cart > 0) {
              $this->enabled = false;
            }
          }
    // eof: do not show if products_id 12, 22, 27 or 122 are in the cart
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREESHIPPER_ZONE > 0) ) {
    Now set the Flat Rate shipping rate to the cost for the Tube Products ...

    If you want to use USPS so that you have the USPS shipping rate for 0.9 to obtain all of the methods, you could customize that for the file:
    /includes/modules/shipping/usps.php

    Code:
        // disable only when entire cart is free shipping
        if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
        }
    
    // bof: show if products_id 193, 194, 195 or 196 are in the cart
          if (!IS_ADMIN_FLAG) {
            global $cart;
    
            $chk_products_in_cart = 0;
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '192');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '193');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '194');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '195');
    
            if ($chk_products_in_cart > 0) {
              $this->enabled = true;
            }
          }
    // eof: adjust weight if products_id 193, 194, 195 or 196 are in the cart
    
        if ($this->enabled) {
    Then change the code:
    Code:
        // usps doesnt accept zero weight send 1 ounce (0.0625) minimum
        $usps_shipping_weight = ($shipping_weight <= 0.0 ? 0.0625 : $shipping_weight);
    
    // bof: show if products_id 193, 194, 195 or 196 are in the cart
          if (!IS_ADMIN_FLAG) {
            global $cart;
    
            $chk_products_in_cart = 0;
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '192');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '193');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '194');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '195');
    
            if ($chk_products_in_cart > 0) {
              if ($shipping_weight <= 0.0) {
                $usps_shipping_weight = 0.9;
              } else {
                $usps_shipping_weight += 0.9;
              }
            }
          }
    // eof: adjust weight if products_id 193, 194, 195 or 196 are in the cart
    
        $shipping_pounds = floor ($usps_shipping_weight);
    Last edited by Ajeh; 6 Jul 2011 at 05:28 AM. Reason: fixed flat.php code
    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!

  3. #3
    Join Date
    Mar 2009
    Location
    New York
    Posts
    157
    Plugin Contributions
    0

    Default Re: Shipping module setting weight independent of number of items ordered

    Vow I am amazed at the bounty. It will take me time to digest all this. Will report to you after testing it. Thanks a million. Donuts on their way.

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

    Default Re: Shipping module setting weight independent of number of items ordered

    NOTE: I have a goober in the Flat Rate flat.php ... I am not taking into account the mixed cart with Tube Products and non-Tube Products ...

    NOTE: if you do not need it, then just ignore the code until I have to to review it again ...

    The USPS and FREE SHIPPING! code seems to be working ...
    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!

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

    Default Re: Shipping module setting weight independent of number of items ordered

    I fixed the flat.php to show only when the number of Products is the same as the Tube Products ...
    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!

  6. #6
    Join Date
    Mar 2009
    Location
    New York
    Posts
    157
    Plugin Contributions
    0

    Default Re: Shipping module setting weight independent of number of items ordered

    Thank you for your response. Is it sufficient to apply the mods to USPS module alone? Does the logic require that I set the weight of the tube items zero or negative?

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

    Default Re: Shipping module setting weight independent of number of items ordered

    Set the weight on the Tube Products to 0 ...

    The code for the FREE SHIPPING! freeshipper and USPS has the customizations for these ...

    You just need to set the right products_id values in the code ...

    If you need more products_id values you can add them by adding another:
    Code:
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '195');
    below the other ones, where you can change the 195 to the next products_id ...
    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!

 

 

Similar Threads

  1. v150 Does UPS module calculate by weight & number of items or just weight?
    By coucho in forum Addon Shipping Modules
    Replies: 4
    Last Post: 12 Dec 2012, 04:58 AM
  2. Shipping weight by number of items per box
    By cmrsf1 in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 17 Apr 2012, 06:30 PM
  3. Setting Default Weight for Items
    By JJMan1 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 28 Jun 2011, 03:17 PM
  4. Shipping multiple items based on total weight, but need weight per box.
    By Nineve in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 2 Aug 2010, 07:42 AM
  5. Setting the number of Items on Index Page
    By field4000 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Oct 2007, 02:16 AM

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