Zen Cart Logo
Forums / Addon Shipping Modules / Limiting shipping options for some product categories

Limiting shipping options for some product categories

Locked

Views: 5,715

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
31 Mar 2008, 5:45 PM
#1
shawnmilo avatar

shawnmilo

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Limiting shipping options for some product categories

I have been asked to add the following feature to Zen Cart:

Reduce the possible shipping methods on the checkout page based on the category of the product being purchased.

Specifically: My friend sells some products which contain hazardous materials, and must be shipped only by UPS, where they can be properly handled and audited. At present, he must manually check each new order, and if it contains certain items he must cancel the order, contact the customer, and ask them to place the order again with the appropriate shipping method.

Although this is to be done for his specific needs, the result is to be contributed back to the Zen Cart community. That being the case, I have two requests for the members of this forum.

  1. Although I can write PHP, I am lost as to where to begin in the enormous pile of files in the Zen Cart installation. I've found the usps and ups modules in the raw code, but not where they are called or how they are selected from among the shipping methods Zen Cart supports. I found the source of the shipping page which presents the shipping information, but it doesn't contain anything I've found useful. I searched these forums, but didn't find anyone discussing which PHP files are to be edited to play with the shipping stuff. I have never dealt with Zen Cart before and know nothing of the way it works. Would someone give me a list of the PHP files I will need to work with to get this job done?

  2. I have been told that this sort of feature has been requested by others before. In the interest in making this as useful to as many people as possible, please let me know how this can help you, and if any approach would make it worthless or invaluable to you.

Thanks,
ShawnMilo

15 Apr 2008, 3:19 PM
#2
shawnmilo avatar

shawnmilo

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

Is this the correct forum for this request?

Thanks,
Shawn

30 Apr 2008, 1:40 PM
#3
shawnmilo avatar

shawnmilo

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

Okay, would someone give me at least a clue why nobody wants to respond to this thread?

Thanks,
Shawn

30 Apr 2008, 2:27 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Limiting shipping options for some product categories

Not everyone is a coder ... :smile:

What happens on mixed carts of hazardous and non-hazardous materials ... how should shipping be handled?

What are you using to flag products that are hazardous? Is this managed by a new field? Or the categories_id or master_categories_id?

30 Apr 2008, 3:46 PM
#5
shawnmilo avatar

shawnmilo

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

Ajeh:

Not everyone is a coder ... :smile:

What happens on mixed carts of hazardous and non-hazardous materials ... how should shipping be handled?

What are you using to flag products that are hazardous? Is this managed by a new field? Or the categories_id or master_categories_id?

The hazardous materials will be identified by the category they belong to -- some of them will be known to the system as "hazmat categories."

Any cart containing any hazmat item will require UPS shipping. If the customer choose to place separate orders they may select an alternate shipping method for the other items, but when ordered in the same checkout, they will only have the UPS option.

Thanks,
Shawn

30 Apr 2008, 4:10 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Limiting shipping options for some product categories

How many Hazmat Categories do you have?

What I am trying to do is find something easy to check in the products table, such as the master_categories_id to compare how many come from those categories vs the total items in the cart ...

If they are equal to 1 or more, then the other shipping modules need to be disabled ...

This means that you need to control the:
$this->enabled

of the other shipping modules a bit more than they are now to know when to hide the other shipping modules ...

Also, when the cart does NOT contain Hazmat Categories Products, does UPS still show? Or does it then need to be masked on the reverse test?

30 Apr 2008, 5:33 PM
#7
shawnmilo avatar

shawnmilo

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

Ajeh:

How many Hazmat Categories do you have?

What I am trying to do is find something easy to check in the products table, such as the master_categories_id to compare how many come from those categories vs the total items in the cart ...

If they are equal to 1 or more, then the other shipping modules need to be disabled ...

This means that you need to control the:
$this->enabled

of the other shipping modules a bit more than they are now to know when to hide the other shipping modules ...

Also, when the cart does NOT contain Hazmat Categories Products, does UPS still show? Or does it then need to be masked on the reverse test?

Your idea sounds like a fine way to go about it. And no, there is no need to have any other limitations imposed if the cart does not contain any hazmat items.

Thanks again,
Shawn

8 May 2008, 2:34 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Limiting shipping options for some product categories

What method(s) of shipping do you need for the whole store aside from the limitation of UPS when there is 1 or more Hazmat Products?

8 May 2008, 2:57 PM
#9
shawnmilo avatar

shawnmilo

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

Ajeh:

What method(s) of shipping do you need for the whole store aside from the limitation of UPS when there is 1 or more Hazmat Products?

The shipping options are currently USPS (Express, Priority, and Parcel Post), and UPS (Next Day Air, Next Day Air Saver, 2nd Day Air, 3 Day Select, and Ground.)

Thanks,
Shawn

8 May 2008, 3:05 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Limiting shipping options for some product categories

So more or less if you put a block on the USPS shipping module that checks for the Hazmat products and if 1 is in the cart then the USPS should NOT show ... this would solve the problem?

If so, are all the Hazmat Products in a specific master_categories_id (Category) that a validation could be build to check how many are in the cart and thus disable USPS as needed?

8 May 2008, 3:29 PM
#11
shawnmilo avatar

shawnmilo

New Zenner

Join Date:
Mar 2008
Posts:
7
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

Ajeh:

So more or less if you put a block on the USPS shipping module that checks for the Hazmat products and if 1 is in the cart then the USPS should NOT show ... this would solve the problem?

If so, are all the Hazmat Products in a specific master_categories_id (Category) that a validation could be build to check how many are in the cart and thus disable USPS as needed?

The solution you mentioned would solve the problem, yes. Also, the hazmat products are all within specific categories, but I don't know if they are "master" categories or not. However, it really doesn't matter which they are, as long as I know which tables I need to look at. If making the modification only apply to master categories would be the best solution for making this a public addition to the code, then I'm all for it, though.

Thanks for all the attention on this.

Shawn

8 May 2008, 5:21 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Limiting shipping options for some product categories

Here is one method of doing this in the USPS shipping module ...

To turn that off when there are one or more Hazmat Products and assuming the Hazmat Products can be tested by the master_categories_id in the products table where 10 is the Hazmat Category ...

Find the code for:

    $this->types = array('EXPRESS' => 'Express Mail',
        'FIRST CLASS' => 'First-Class Mail',
        'PRIORITY' => 'Priority Mail',
        'PARCEL' => 'Parcel Post',
        'MEDIA' => 'Media Mail',
        'BPM' => 'Bound Printed Material',
        'LIBRARY' => 'Library'
        );

Change it so that just above it you would have:

// skip Hazmat Products
    if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','10') > 0) {
      $this->enabled = false;
    }

That will then hide the USPS shipping module when something is a Hazmat Product in the categories_id (via master_categories_id) of 10 ...

7 Jun 2008, 5:11 PM
#13
loosefast avatar

loosefast

Zen Follower

Join Date:
Jun 2005
Posts:
199
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

How to show more than one limiting category?

thanks

26 Jun 2008, 12:46 PM
#14
yaeger4 avatar

yaeger4

New Zenner

Join Date:
May 2007
Posts:
4
Plugin Contributions:
0

Re: Limiting shipping options for some product categories

I think this is the solution for me but i can't make it work... I have large items that must go frieght... so I made everything a flat rate by doing ITEM BY UNIT and making the weight what I want to charge for shipping... but the problem is now I have to do that for all of my items

Is there a way I can exclude shipping UPS and ship PER UNIT on all my other items.

Thanks.... Marty