Page 6 of 10 FirstFirst ... 45678 ... LastLast
Results 51 to 60 of 99
  1. #51
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

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

    Remind me, as my mind is slow ...

    For Table409 you need:

    1 All Products must be from these categories?

    2 All Products may NOT be from these categories?

    The control is in these choices:
    Code:
    // if number of Products do not match ALL Products in the Cart disable
        if (($chk_cat_total) != $chk_catAll) {
          $this->enabled = false;
        }
    Code:
    // if number of Products does match ALL Products in the Cart disable
        if (($chk_cat_total) == $chk_catAll) {
          $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!]
    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!

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

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

    Well, the logic should be in two files.

    table409.php - IF all the products in the cart ARE from ONLY these categories then enable

    table.php - IF all the products in the cart ARE from ONLY these categories then disable

    I'm testing it now with a few different scenarios.

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

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

    Quote Originally Posted by limelites View Post
    Well, the logic should be in two files.
    table409.php - IF all the products in the cart ARE from ONLY these categories then enable
    Code:
    // disable if checked count does NOT equal total count
        if (($chk_cat_total) != $chk_catAll) {
          $this->enabled = false;
        }
    Quote Originally Posted by limelites View Post
    Well, the logic should be in two files.
    table.php - IF all the products in the cart ARE from ONLY these categories then disable
    Code:
    // disable checked count DOES equal total count
        if (($chk_cat_total) == $chk_catAll) {
          $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!]
    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. #54
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

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

    Almost working... but not quite. When I had several products in cart from a mix of different linked and main cats it was showing only the table409.php option at checkout.

    However, adding some bulkier products (from categories outside the list of ID's I'm using) and the table409.php is still the only option. It should not show at this stage. Only the table.php option should show. Let me paste the contents of both files. I think it's one of my stupid syntax things!

    table409.php
    PHP Code:
    // bof: only show if all Products are from individual products_id and Master/Linked Categories
      
    if (!IS_ADMIN_FLAG) {


    //-------------------------------------------------------------------------------------------------
        // check individual products_id 168, 169, 172
    //    $chk_products_found = 0;
    //    $chk_products = $_SESSION['cart']->get_products();
    //    for ($i=0, $n=sizeof($chk_products); $i<$n; $i++) {
    //      if ( in_array((int)$chk_products[$i]['id'], array(168, 169, 172)) ) {
    //        $chk_products_found += $chk_products[$i]['quantity'];
    //      }
    //   }
    //echo 'Products Individual Found: ' . $chk_products_found . '<br>';
    //-------------------------------------------------------------------------------------------------


        // check Products from Linked Categories 5, 10, 22
        
    $chk_linked $db->Execute("SELECT distinct products_id FROM " TABLE_PRODUCTS_TO_CATEGORIES " WHERE categories_id IN (409, 7, 103, 104, 105, 336, 372, 361, 397, 395, 385, 401, 391, 400, 394, 384, 387, 399, 390)");
        while(!
    $chk_linked->EOF) {
          
    $selected_products_check .= $chk_linked->fields['products_id'];
          
    $chk_linked->MoveNext();
          if (!
    $chk_linked->EOF) {
            
    $selected_products_check .= ',';
          }
        }
        
    $selected_products explode(','$selected_products_check);
        
    // check cart contents for linked products
        
    $chk_products_linked $chk_products;
        
    $chk_products_found_linked 0;
        for (
    $i=0$n=sizeof($chk_products_linked); $i<$n$i++) {
          if ( 
    in_array((int)$chk_products_linked[$i]['id'], $selected_products) ) {
            
    $chk_products_found_linked += $chk_products_linked[$i]['quantity'];
          }
        }
    echo 
    'Products Master/Linked Found: ' $chk_products_found_linked '<br>';

        
    $chk_cat_total = ($chk_products_found $chk_products_found_linked);

        
    // if any Products are found and does not match ALL products in cart turn off the shipping module
        
    if (($chk_cat_total) != $chk_catAll) {
          
    $this->enabled false;
        }
      }
    // eof: only show if all Products are from individual products_id and Master/Linked Categories 

    table.php
    PHP Code:
    // bof: only show if all Products are OUTWITH Master/Linked Categories
      
    if (!IS_ADMIN_FLAG) {


    //-------------------------------------------------------------------------------------------------
        // check individual products_id 168, 169, 172
    //    $chk_products_found = 0;
    //    $chk_products = $_SESSION['cart']->get_products();
    //    for ($i=0, $n=sizeof($chk_products); $i<$n; $i++) {
    //      if ( in_array((int)$chk_products[$i]['id'], array(168, 169, 172)) ) {
    //        $chk_products_found += $chk_products[$i]['quantity'];
    //      }
    //   }
    //echo 'Products Individual Found: ' . $chk_products_found . '<br>';
    //-------------------------------------------------------------------------------------------------


        // check Products from Linked Categories 
        
    $chk_linked $db->Execute("SELECT distinct products_id FROM " TABLE_PRODUCTS_TO_CATEGORIES " WHERE categories_id IN (409, 7, 103, 104, 105, 336, 372, 361, 397, 395, 385, 401, 391, 400, 394, 384, 387, 399, 390)");
        while(!
    $chk_linked->EOF) {
          
    $selected_products_check .= $chk_linked->fields['products_id'];
          
    $chk_linked->MoveNext();
          if (!
    $chk_linked->EOF) {
            
    $selected_products_check .= ',';
          }
        }
        
    $selected_products explode(','$selected_products_check);
        
    // check cart contents for linked products
        
    $chk_products_linked $chk_products;
        
    $chk_products_found_linked 0;
        for (
    $i=0$n=sizeof($chk_products_linked); $i<$n$i++) {
          if ( 
    in_array((int)$chk_products_linked[$i]['id'], $selected_products) ) {
            
    $chk_products_found_linked += $chk_products_linked[$i]['quantity'];
          }
        }
    echo 
    'Products Master/Linked Found: ' $chk_products_found_linked '<br>';

        
    $chk_cat_total = ($chk_products_found $chk_products_found_linked);

        
    // if any Products are found and does not match ALL products in cart turn off the shipping module
        
    if (($chk_cat_total) == $chk_catAll) {
          
    $this->enabled false;
        }
      }
    // eof: only show if all Products are OUTWITH Master/Linked Categories 

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

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

    Not sure why, but it doesn't matter what's in your cart now. Only table409.php shows. Regardless of product or category. It's never table.php. Always table409.php

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

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

    Right now, Table409 is saying if checked categories does NOT match ALL Products in the cart, it should be disabled ...

    Right now, Table is saying if checked categories DOES match ALL Products in the cart, it should be disabled ...
    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!

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

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

    I have to run for a few hours but I will review the code and see if I might have goobered up somewhere ... not that I ever goober up things ...
    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. #58
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

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

    See what happens if you uncomment these two lines:
    Code:
    //    $chk_products_found = 0;
    //    $chk_products = $_SESSION['cart']->get_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!

  9. #59
    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 Ajeh View Post
    See what happens if you uncomment these two lines:
    Code:
    //    $chk_products_found = 0;
    //    $chk_products = $_SESSION['cart']->get_products();
    Uncommenting those two lines seems to have no effect. I have a product in the cart which does not come under the category ID's in the list. However, the only option is shown as teble409.php. It should be table.php.

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

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

    Below those two can you add:
    Code:
        $chk_products_found = 0;
        $chk_products = $_SESSION['cart']->get_products();
        $chk_catAll = $_SESSION['cart']->count_contents();
    
    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!

 

 
Page 6 of 10 FirstFirst ... 45678 ... LastLast

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