Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    Oct 2009
    Posts
    6
    Plugin Contributions
    0

    Default Flat rate for 1 category, Per Item for all others

    Hi,
    I'm having trouble setting up a shipping rule I require.

    I have 1 category (Seed) which will always have a flat rate of $1.50 shipping regardless of quantity ordered and other categories that I want to use per item shipping.

    Is it possible to set up ZenCart to use the flat rate for all category 1 purchases as well as the shipping per item for anything purchased from another category?

    An example could be:
    A customer purchases 6 packets of seed and, let's say a dehydrator and some clips which have different shipping costs ($10 and $2) and come from category 2.

    Total shipping should be $13.50. Can this be done?

    Also, can the shipping be left blank awaiting a total shipping quote as many of the items I sell require individual shipping quotations.

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

    Default Re: Flat rate for 1 category, Per Item for all others

    Let's assume that the categories_id is 10 ... and that it is the master_categories_id for all of the Seeds ...

    You can edit the shipping module:
    /includes/modules/shipping/item.php

    and change the function quote by replacing it with:
    Code:
    // class methods
        function quote($method = '') {
          global $order, $total_count;
    
          // adjusted count for free shipping
          $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
    
          // check number of seeds ordered from categories_id 10
          $chk_seeds = $_SESSION['cart']->in_cart_check('master_categories_id','10');
          $item_total_count = $item_total_count - $chk_seeds;
          if ($chk_seeds > 0) {
            $chk_seeds_shipping = 1.50;
          } else {
            $chk_seeds_shipping = 0.00;
          }
          $this->quotes = array('id' => $this->code,
                                'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                                'methods' => array(array('id' => $this->code,
                                                         'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                         'cost' => (MODULE_SHIPPING_ITEM_COST * $item_total_count) + $chk_seeds_shipping + MODULE_SHIPPING_ITEM_HANDLING)));
    
          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;
        }
    Now all Products using the master_categories_id 10 will be removed from the count that Item Rate item shipping uses and charge $1.50 if any are in the cart ...

    Just change the '10' to the master_categories_id for the Seeds ...

    See if that works for you ...
    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!

  3. #3
    Join Date
    Oct 2009
    Posts
    6
    Plugin Contributions
    0

    Default Re: Flat rate for 1 category, Per Item for all others

    Thanks for your reply. It doesn't seem to be working correctly.
    I ran a test purchase of 5 packets of seed ($1.50 flat rate postage) and 1 Preserver ($20 postage). The two options for postage presented to me were:

    Please select the preferred shipping method to use on this order.
    Flat Rate $1.50Best Way
    Per Unit $45.75Best Way

    The postage should have calculated to $21.50, any ideas?

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

    Default Re: Flat rate for 1 category, Per Item for all others

    The code posted was to work with the Item Rate item shipping module based on the "per item" referrance in your first post ...

    Now, however, you are showing Flat Rate and Per Unit perunitweight shipping modules ...

    Flat Rate is a single charge for the whole order ...

    Per Unit is based on the full weight of the order ...

    What shipping module do you want to use this code with?
    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!

  5. #5
    Join Date
    Oct 2009
    Posts
    6
    Plugin Contributions
    0

    Default Re: Flat rate for 1 category, Per Item for all others

    Sorry for the confusion. I want to use per unit perunitweight method for most categories (I understand this is the way to have individual shipping cost per item) but I want to add $1.50 to the total order shipping cost if any items are purchased from category 1. In other words I want shipping calculated by adding all the individual shipping costs for non category 1 purchases and then add $1.50 if any number of Category 1 items are purchased. You may have guessed; I am new to ZenCart.

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

    Default Re: Flat rate for 1 category, Per Item for all others

    See if this works for you on the Per Unit perweightunit shipping module:
    Code:
      function quote($method = '') {
        global $order, $shipping_weight;
    
        global $total_count;
        // check number of seeds ordered from categories_id 10
        $chk_seeds = $_SESSION['cart']->in_cart_check('master_categories_id','10');
        if ($chk_seeds > 0) {
          $chk_seeds_shipping = 1.50;
        } else {
          $chk_seeds_shipping = 0.00;
        }
    
        $total_weight_units = $shipping_weight;
        $this->quotes = array('id' => $this->code,
                              'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
                              'methods' => array(array('id' => $this->code,
                                                       'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
                                                       'cost' => (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units) + $chk_seeds_shipping
                                                                  + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING)));
    
        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;
      }
    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!

  7. #7
    Join Date
    Oct 2009
    Posts
    6
    Plugin Contributions
    0

    Default Re: Flat rate for 1 category, Per Item for all others

    Looks like I've messed things up pretty well now. I can't get any of the postage to work properly. I reverted to the original item.php and tried to set up per unit (perunitweight) shipping. Set the weight of the products to 1.5 and thought I'd be okay. Nope, now I have no idea how it is calculating postage. 1 pack of seeds returns a shipping cost of $0. I'm losing the plot. I thought ZenCart would be relatively easy to set up but no. I just want to put my products in, assign a postage cost and build in the smarts for the Category 1 items. Thanks for your help, looks like back to ebay for me as I can't afford the time to learn how to drive this thing.

  8. #8
    Join Date
    Oct 2009
    Posts
    6
    Plugin Contributions
    0

    Default Re: Flat rate for 1 category, Per Item for all others

    I've had another go at it and have the following results.

    Cart contains 3 x seed = $1.50 postage total
    1 x preserver $20.00 postage

    Total postage should be $21.50

    Calculated postage is $26.00

    Is it possible it is adding the $20 + (3x$1.50) + $1.50 - perhaps the maths logic is wrong - I'm not quite sure how to read it.

    Any assistance would be appreciated.

  9. #9
    Join Date
    Oct 2009
    Posts
    6
    Plugin Contributions
    0

    Default Re: Flat rate for 1 category, Per Item for all others

    Managed to figure out the problem. I need to use 0 weight for the seed to have it calculate correctly.

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

    Default Re: Flat rate for 1 category, Per Item for all others

    Thanks for the update that you had the weight added for the seeds and needed to remove that ... glad to hear that this does work for you ...
    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!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Flat Rate Shipping per Item for Motor Freight
    By Jeffg23 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 23 Aug 2014, 07:09 PM
  2. Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories?
    By BlackOrchidCouture in forum Built-in Shipping and Payment Modules
    Replies: 69
    Last Post: 10 Aug 2010, 10:23 AM
  3. Drop shipping for some items and flat rate for others
    By covergirlbeads in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 18 Aug 2009, 07:35 PM
  4. Flat Rate for 1 category/item only
    By mheishman in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 16 May 2009, 06:55 AM
  5. Auspost: Flat rate for Metro, while based on weight for others?
    By xman888 in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 16 Jan 2008, 03:00 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