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 21 to 40 of 99
10 Apr 2013, 3:16 PM
#21
limelites avatar

limelites

Totally Zenned

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

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

**It works! Wow, **I'd never have thought the sort order would do that. Thanks Ajeh, it's "almost" perfect!

Now, is it possible to do the opposite code and place it in the table.php file, so that it's detecting when the cart only has items from category 409 and therefore not showing as an option?

10 Apr 2013, 3:37 PM
#22
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?

Neat eh?

// bof: do not 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_cat409 = $_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: do not show if all Products are from 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!

10 Apr 2013, 3:54 PM
#23
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?

That's pretty amazing! I mean what you can do with code!! You're amazing Ajeh!!!

10 Apr 2013, 3:57 PM
#24
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?

Glad that things are now working for you ... :smile:

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!

10 Apr 2013, 4:15 PM
#25
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?

Another few jars of coffee en-route :hug:

10 Apr 2013, 4:19 PM
#26
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?

Thank you kindly for the support, the Zen Cart Team really appreciates it greatly! :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!

10 Apr 2013, 4:34 PM
#27
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?

Another quick question though? How would I add categories to that code, so that it wasn't just category 409. Say for example I wanted to apply these very same rules to categories 409, 7, 105, 103, 104, 336, 372 and 361?

And what if some of those category ID's weren't actually master categories?

10 Apr 2013, 4:43 PM
#28
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?

Follow this pattern and add as many as you need:

// bof: only show if all Products are from master_categories_id 409, 7, 103, 104
  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
    $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');
    // if any are found turn off the shipping module
    if ($chk_cats != $chk_catAll) {
      $this->enabled = false;
    }
  }
// eof: only show if all Products are from master_categories_id 409, 7, 103, 104

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!

10 Apr 2013, 4:43 PM
#29
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?

And what if some of those category ID's weren't actually master categories?

Meaning what, exactly? :blink:

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:38 AM
#30
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:

Meaning what, exactly? :blink:

Meaning, the products are just linked to the category and the products isn't in there originally, so the category isn't the master category. I don't suppose it would matter?

11 Apr 2013, 6:56 AM
#31
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?

Yeah, as suspected. I've implemented the new multi-category coding but because some of the small products are in sub-categories (i.e., linked from their master category to a more specific sib-category) then the sub-category ID isn't being picked up by this new code.

So, by example take the "accessories" category. You might have hundreds of small crystal brooches in there, alongside lots of chunky big candles. These are all types of accessories. However, we have sub-categories called "brooches" and sub-categories called "candles" and the brooches are 'linked' into the sub category, 'brooches' from the master category, 'accessories'.

Is there a way to make the code work with products which are "linked" to a category, as well as products contained in a "master category"? Or, do I have to look at moving these products so that the current sub-category becomes their master category and then linking them back to accessories category as linked products? So, reversing them if you like?

11 Apr 2013, 12:39 PM
#32
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?

Do you have a site and a couple URLs to these Categories that are Linked and not using the immediate Category as their master_categories_id ... I kinda need to envision this by seeing the reality of it, as I got a plan ... :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, 12:58 PM
#33
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?

Morning Linda, thanks for getting back. Yes, let me show you:

Look at this master category for an example:
http://www.silkblooms.co.uk/all-wedding-products-bridesmaid-flowers-c-1_24.html

We have all the flowers that pertain to bridesmaids in this master category. We have also linked them into the sub categories which appear in the "Design Filter" you'll see as a sidebox now above the others.

So, from the Design Filter categories, we'd like the smaller products on the new shipping table rates. Not the bulkier products. Smaller products are "Hair Flowers" and "Wrist Corsages" (category ID's 336 and 372).... but those aren't master categories, so this isn't working for them (it only works for the products master categories):

    $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');
11 Apr 2013, 1:03 PM
#34
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?

Would this work?

$chk_cats += $_SESSION['cart']->in_cart_check('**category**_id','336');
$chk_cats += $_SESSION['cart']->in_cart_check('**category**_id','372'); 

Is there a proper syntax for that? Or, do I need to run some magical SQL script that will make every product in these categories adopt them as their new master category, but still keep them linked into their current master category?

11 Apr 2013, 1:14 PM
#35
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?

That would not work ...

Is this a Live Site or a Working site?

The idea here is can you turn off the SEO/Rewrites as I cannot see what I am doing ... :blink:

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, 1:25 PM
#36
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?

It's definitely a live site :) I should really keep a working site but I've never gotten round to it unfortunately.

11 Apr 2013, 1:31 PM
#37
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?

Yes siree bob ... sure would be nice to have a play site ... :lookaroun

Let me have a while to give this a think as I do believe I have a plan that will work ... I think ... ummm, yeah it should work ... but I need to fool with the data and make it somewhat efficient ...

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, 1:52 PM
#38
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 the sound of that, 'efficient data' :laugh:

I'm curious to see what you come up with now. The mind boggles (literally) :dontgetit

11 Apr 2013, 1:53 PM
#39
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 am rather curious as well about what I will come up with ... but I will come up with something ... :P

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, 1:59 PM
#40
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?

It's funny how there isn't something similar to:
$chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','336');

like:
$chk_cats += $_SESSION['cart']->in_cart_check('category_id','336');