Forums / General Questions / Flat Rate Shipping - Table Rates - Duplicate for Category Specific Items?

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

Views: 8,738

Results 41 to 60 of 99
11 Apr 2013, 2:13 PM
#41
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

That's cause when I made that cute little function to grab info from the shopping cart it did not occur to me to make an ambiguous function to do that ...

And, as you want a bazillion possible categories_id from Linked products to be checked now there are while loops and other fun things to check out and some ways to approach this are doggie and others are fast ...

Hense ... da think ... think ... think ... for a few ... hopefully minutes rather than days ... :cool:

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!

11 Apr 2013, 2:34 PM
#42
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

I like how you think like a woman of action, but act like a woman of thought :smile:

11 Apr 2013, 3:33 PM
#43
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

Okay ... hopefully this covers all the bases so that you can determine what you really want ... :lookaroun

// bof: only show if all Products are from master_categories_id, individual products_id and Linked Categories
  if (!IS_ADMIN_FLAG) {
    // check the count of a specific field
    $chk_catAll = 0;
    $chk_cats = 0;
    $chk_catAll = $_SESSION['cart']->count_contents();
    // check how many Products are in the cart for master_categories_id 409, 7, 103, 104, 12
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','409');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','7');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','103');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','104');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','12');
echo 'Products master_categories_id Found: ' . $chk_cats . '<br>';

    // 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 products_to_categories WHERE categories_id IN (5, 10, 22)");
    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 Linked Found: ' . $chk_products_found_linked . '<br>';

    // if any are found turn off the shipping module
    if (($chk_cats + $chk_products_found + $chk_products_found_linked) != $chk_catAll) {
      $this->enabled = false;
    }
  }
// eof: only show if all Products are from master_categories_id, individual products_id and Linked Categories

So you have 3 methods here:
1 Check by master_categories_id

2 Check by individual products_id

3 Check by Products that are linked to categories

NOTE: the echos are there so you can see the results of each check ...

NOTE: this does NOT test that you did not combine Products in each test multiple times, meaning if you have Products that are in the master_categories_id check that are also in the Linked Categories test and/or Individual Product test then they will be counted multiple times ...

So, I would need to work out a "cleaner" to prevent multiple counts of the 3 test, if you think that may happen ...

If you think that may happen, fess up now ...

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!

11 Apr 2013, 5:11 PM
#44
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

Thank you for doing all that Ajeh, it looks really, really, really complicated :) I've been creating a play-site while you were thinking:

http://www.silkblooms.co.uk/test/

I think I will put the mod on there and give it a whirl. I'm not sure what combo could potentially break things, so I'll try a few. Doe it matter if the products are counted multiple times? Counted by what? The cart?

11 Apr 2013, 5:28 PM
#45
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

Smarter code ...

1 Test for Categories and 1 test for Individual Products:

// 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/Master Categories 5, 10, 12, 22, 64
    $chk_linked = $db->Execute("SELECT distinct products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE categories_id IN (5, 10, 12, 22, 64)");
    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

At this point, Individual Products are NOT checked to see if they have already been counted so I need to know if you even need that check or not ...

Duplicate count matters if you need a comparison to total items in cart and I think that you do ...

However, if you do not need any Individual Product counts, then just the test for the Master/Linked categories should be good ...

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!

11 Apr 2013, 5:29 PM
#46
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

NOTE: my Category numbers are not YOUR category numbers so you need to adjust for that ...

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!

11 Apr 2013, 5:53 PM
#47
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

Adjusting with my category numbers and commenting out the product ID test, but is this code intended for table409.php (to enable shipping module) or table.php (to disable shipping module)?

// bof: only show if all Products are from master_categories_id, individual products_id and Linked Categories
  if (!IS_ADMIN_FLAG) {
    // check the count of a specific field
    $chk_catAll = 0;
    $chk_cats = 0;
    $chk_catAll = $_SESSION['cart']->count_contents();
    // check how many Products are in the cart for master_categories_id 409 etc
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','409');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','7');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','103');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','104');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','105');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','336');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','372');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','361');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','397');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','395');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','385');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','401');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','400');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','391');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','394');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','384');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','387');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','399');
    $chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','390'); 
	echo 'Products master_categories_id Found: ' . $chk_cats . '<br>';


 //------------------------------------------------------------------------------------
    // 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 409 etc
    $chk_linked = $db->Execute("SELECT distinct products_id FROM 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 Linked Found: ' . $chk_products_found_linked . '<br>';

    // if any are found turn off the shipping module
    if (($chk_cats + $chk_products_found + $chk_products_found_linked) != $chk_catAll) {
      $this->enabled = false;
    }
  }
// eof: only show if all Products are from master_categories_id, individual products_id and Linked Categories

It's not echoing that products from the linked cats are there. So, it's not counting them still. I have this added to table409.php though. Is this intended for table.php? I have difficulty understanding some real basics like == or != or = so it confuses me which file this is for :(

11 Apr 2013, 6:01 PM
#48
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

Smarter code in table409.php:

// 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
11 Apr 2013, 6:03 PM
#49
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

With the smarter code in table409.php and with three products from linked cats and one product from a master cat in cart at checkout page:

Products Master/Linked Found: 0

Both table.php and table409.php are showing as options at the checkout page.

11 Apr 2013, 6:06 PM
#50
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

Then with one master cat product in the cart:

Products Master/Linked Found: 0

..... but only the table409.php option available.

I think I need to edit the opposite code into table.php with a sneaky != somewhere?

11 Apr 2013, 6:06 PM
#51
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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:

// if number of Products do not match ALL Products in the Cart disable
    if (($chk_cat_total) != $chk_catAll) {
      $this->enabled = false;
    }
// 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!

11 Apr 2013, 6:25 PM
#52
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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.

11 Apr 2013, 6:33 PM
#53
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

limelites:

Well, the logic should be in two files.
table409.php - IF all the products in the cart ARE from ONLY these categories then enable

// disable if checked count does NOT equal total count
    if (($chk_cat_total) != $chk_catAll) {
      $this->enabled = false;
    }

limelites:

Well, the logic should be in two files.
table.php - IF all the products in the cart ARE from ONLY these categories then disable

// 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!

11 Apr 2013, 6:34 PM
#54
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

// 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

// 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
11 Apr 2013, 6:45 PM
#55
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

11 Apr 2013, 7:15 PM
#56
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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!

11 Apr 2013, 7:27 PM
#57
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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 ... :lookaroun

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!

11 Apr 2013, 7:45 PM
#58
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

See what happens if you uncomment these two lines:

[B]//[/B]    $chk_products_found = 0;
[B]// [/B]   $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!

11 Apr 2013, 8:46 PM
#59
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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

Ajeh:

See what happens if you uncomment these two lines:

[B]//[/B] $chk_products_found = 0;
[B]// [/B] $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.
11 Apr 2013, 10:46 PM
#60
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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

Below those two can you add:

    $chk_products_found = 0;
    $chk_products = $_SESSION['cart']->get_products();
[B]    $chk_catAll = $_SESSION['cart']->count_contents();
[/B]

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!