Results 1 to 10 of 99

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Flat Rate Shipping - Table Rates - Duplicate for Category Specific Items?

    I have a bit of a dilemma since Royal Mail have raised changed their prices to extortion levels.

    We had to increase our table rates across the whole site so that now the minimum UK shipping is £6.00, then we have £1.00 increases based on order value.

    My dilema is with the ribbons that we sell as these are quite small and they do fit in the new cube sized boxes that Royal Mail will still post for under £4.00. Ideally, we would like to have our site set up so that customers checking out with only products from category ID 409 will be using a different table rate from anyone with products from a different category.

    Is this even possible? If I were to duplicate the "Table" shipping module and call is say, Table409. How would I code the cart/checkout to differentiate between carts with only products from category 409 and all other carts?

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

    Default Re: Flat Rate Shipping - Table Rates - Duplicate for Category Specific Items?

    Let's say you want Table Rate table to only show when the whole order is from master_categories_id 15 ...

    Edit the shipping module:
    /includes/modules/shipping/table.php

    with the code in RED:
    Code:
        // disable only when entire cart is free shipping
        if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
        }
    
    // bof: only show if all Products are from master_categories_id 15
      if (!IS_ADMIN_FLAG) {
        // check the count of a specific field
        $chk_catAll = 0;
        $chk_cat15 = 0;
        $chk_catAll = $_SESSION['cart']->count_contents();
        // check how many Products are in the cart for master_categories_id 15
        $chk_cat15 = $_SESSION['cart']->in_cart_check('master_categories_id','15');
        // if any are found turn off the shipping module
        if ($chk_cat15 != $chk_catAll) {
          $this->enabled = false;
        }
      }
    // eof: only show if all Products are from master_categories_id 15
    
        if ($this->enabled) {
          // check MODULE_SHIPPING_TABLE_HANDLING_METHOD is in
    For master_categories_id 409, change the 15 to 409 in each occurrence ...
    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
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Flat Rate Shipping - Table Rates - Duplicate for Category Specific Items?

    I must be doing something wrong. Knowing me, it's probably something really stupid but I've cloned the table.php by following this thread:

    http://www.zen-cart.com/showthread.p...hipping-module

    I've called the file table409.php and created a corresponding language file. I've change all instances of "table" or "table2" to "table409" and all instances of "TABLE" or "TABLE2" to "TABLE409". Uploaded and voila, the shipping module appears as it should in admin.

    When I install it in admin and enter the shipping rates for the products in category 409, it seems to completely disable both table.php shipping modules. Tha is to say, the flat rate UK shipping option just completely disappears from the checkout confirmation page, no matter what is in the cart.

    Here is the code that I inserted in /includes/modules/shipping/table409.php, but I don' think the problem is caused by this:

    PHP Code:
    // bof: only show if all Products are from master_categories_id 409
      
    if (!IS_ADMIN_FLAG) {
        
    // check the count of a specific field
        
    $chk_catAll 0;
        
    $chk_cat409 0;
        
    $chk_catAll $_SESSION['cart']->count_contents();
        
    // check how many Products are in the cart for master_categories_id 409
        
    $chk_cat15 $_SESSION['cart']->in_cart_check('master_categories_id','409');
        
    // if any are found turn off the shipping module
        
    if ($chk_cat409 != $chk_catAll) {
          
    $this->enabled false;
        }
      }
    // eof: only show if all Products are from master_categories_id 409 
    Here is a screenshot of the admin settings for both table.php and table409.php:


  4. #4
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Flat Rate Shipping - Table Rates - Duplicate for Category Specific Items?

    Quote Originally Posted by limelites View Post
    I must be doing something wrong. Knowing me, it's probably something really stupid but I've cloned the table.php by following this thread:

    http://www.zen-cart.com/showthread.p...hipping-module

    I've called the file table409.php and created a corresponding language file. I've change all instances of "table" or "table2" to "table409" and all instances of "TABLE" or "TABLE2" to "TABLE409". Uploaded and voila, the shipping module appears as it should in admin.

    When I install it in admin and enter the shipping rates for the products in category 409, it seems to completely disable both table.php shipping modules. Tha is to say, the flat rate UK shipping option just completely disappears from the checkout confirmation page, no matter what is in the cart.

    Here is the code that I inserted in /includes/modules/shipping/table409.php, but I don' think the problem is caused by this:

    PHP Code:
    // bof: only show if all Products are from master_categories_id 409
      
    if (!IS_ADMIN_FLAG) {
        
    // check the count of a specific field
        
    $chk_catAll 0;
        
    $chk_cat409 0;
        
    $chk_catAll $_SESSION['cart']->count_contents();
        
    // check how many Products are in the cart for master_categories_id 409
        
    $chk_cat15 $_SESSION['cart']->in_cart_check('master_categories_id','409');
        
    // if any are found turn off the shipping module
        
    if ($chk_cat409 != $chk_catAll) {
          
    $this->enabled false;
        }
      }
    // eof: only show if all Products are from master_categories_id 409 
    Here is a screenshot of the admin settings for both table.php and table409.php:


    I've just triple checked everything and reinstalled and it still has the same issue. However, when I comment out the new category exclusion code, it stops the interference.

    PHP Code:
    // bof: only show if all Products are from master_categories_id 409
    //  if (!IS_ADMIN_FLAG) {
        // check the count of a specific field
      //  $chk_catAll = 0;
        //$chk_cat409 = 0;
        //$chk_catAll = $_SESSION['cart']->count_contents();
        // check how many Products are in the cart for master_categories_id 409
        //$chk_cat15 = $_SESSION['cart']->in_cart_check('master_categories_id','409');
        // if any are found turn off the shipping module
        //if ($chk_cat409 != $chk_catAll) {
         // $this->enabled = false;
       // }
     // }
    // eof: only show if all Products are from master_categories_id 409 
    With this commented out, I can then see the flat rate shipping option again. So, it's something to do with this code I'd say, or the way I've edited it?

  5. #5
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Flat Rate Shipping - Table Rates - Duplicate for Category Specific Items?

    Another quick update, with the new code commented out and both the new table409.php and the original table.php enabled, the checkout page doesn't show both options, only the new one. So, the cloned one seems to override the original one. I've no idea why.

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

    Default Re: Flat Rate Shipping - Table Rates - Duplicate for Category Specific Items?

    You appear to have changed all of the $chk_cat15 to $chk_cat409 except one:
    Code:
       $chk_cat15 = $_SESSION['cart']->in_cart_check('master_categories_id','409');
    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. free shipping for specific zip code, flat rate otherwise
    By newdre in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 11 Jan 2012, 11:39 AM
  2. Flat Rate Shipping for Small Items
    By AirsoftOutfitter in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 18 Mar 2010, 10:22 PM
  3. Calculate shipping on all items, except flat rate on specific category
    By buckit in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 1 Dec 2009, 06:24 PM
  4. Flat rate just for a set cities and UPS or USPS shipping rates for States
    By pkalout in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 9 Oct 2009, 04:20 PM
  5. Flat Rate shipping challenge - need a separate rate for a few heavier items
    By Nigel Lew in forum Built-in Shipping and Payment Modules
    Replies: 9
    Last Post: 27 Jun 2008, 10:07 PM

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