Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Free Shipping Options module, how to exclude some categories?

Free Shipping Options module, how to exclude some categories?

Views: 6,157

Results 21 to 30 of 30
1 Mar 2011, 2:08 PM
#21
ajeh avatar

ajeh

Oba-san

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

Free Shipping Options module, how to exclude some categories?

Check the /cache directory and ensure you have no error logs being generated on this ...

2 Mar 2011, 4:30 AM
#22
geodave avatar

geodave

New Zenner

Join Date:
Apr 2009
Posts:
17
Plugin Contributions:
0

Re: Free Shipping Options module, how to exclude some categories?

Definitely had error logs, a myriad of errors.
I think this is too advanced for me unfortunately, I'm sorry the time you put into helping me was wasted, I really do appreciate the help.

I literally just need to modify freeoptions.php so it will disable the free shipping option if I add a product from, say, category 108.

I think I need to do a lot more reading before I can get a handle on how to do that.

2 Mar 2011, 4:48 AM
#23
geodave avatar

geodave

New Zenner

Join Date:
Apr 2009
Posts:
17
Plugin Contributions:
0

Re: Free Shipping Options module, how to exclude some categories?

For instance, to throw away everything that seems unneccessary, can I just put this in freeoptions?

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

I can't imagine a simpler way to do it (I think you wrote this code in another thread). Yet if I take an order that qualifies for free shipping, and add a product from category 108, I still am offered the free shipping option.

2 Mar 2011, 2:39 PM
#24
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping Options module, how to exclude some categories?

If your Products are using the categories_id 108 as their master_categories_id then this should work to disable Free Shipping Options freeoptions shipping module ...

Just add the code below:

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
      }

so you should have:

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
      }

// skip certain categories
      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','10') > 0) {
        $this->enabled = false;
      }
4 Mar 2011, 3:50 AM
#25
geodave avatar

geodave

New Zenner

Join Date:
Apr 2009
Posts:
17
Plugin Contributions:
0

Re: Free Shipping Options module, how to exclude some categories?

Wish I knew what to say. I have the code just like you've got it there, and I can still add a whole cart's worth of product 108 and get free shipping. It makes no sense.
No errors in the cache.

...darn.

4 Mar 2011, 4:10 AM
#26
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping Options module, how to exclude some categories?

Did you change the '10' to '108' or whatever master_categories_id that you are testing? :unsure:

4 Mar 2011, 6:11 AM
#27
tj1 avatar

tj1

Totally Zenned

Join Date:
Mar 2005
Location:
California
Posts:
628
Plugin Contributions:
0

Re: Free Shipping Options module, how to exclude some categories?

geodave, did you create the extra function file with the code in post #12 and put it in your extra functions folders?

If the simpler code Ajeh provided is not working is probably because your category id 108 is not the immediate category that contains the products, your products might be in a subcategory of category id 108.

4 Mar 2011, 2:41 PM
#28
geodave avatar

geodave

New Zenner

Join Date:
Apr 2009
Posts:
17
Plugin Contributions:
0

Re: Free Shipping Options module, how to exclude some categories?

Did you change the '10' to '108' or whatever master_categories_id that you are testing?

I knew I should have specified that, but yes I did :)

If the simpler code Ajeh provided is not working is probably because your category id 108 is not the immediate category that contains the products, your products might be in a subcategory of category id 108.

It is set up like this: Catalog top -> Clothing -> Shirts. Shirts is category 108, it has no subcategories, and all 10 products in the "Shirts" category show "Product Master Category ID# 108 Shirts"

Is it possible that in freeoptions, although I'm setting this->enabled=false, it is being switched back to true through some other means?
Like maybe the fact that the cart is past the price threshold for free shipping, that's overruling the code that should bar category 108?

4 Mar 2011, 3:10 PM
#29
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping Options module, how to exclude some categories?

You could zip your Free Shipping Options freeoptions shipping module and add it as an attachment so we can see what might be happening ...

5 Mar 2011, 3:51 AM
#30
tj1 avatar

tj1

Totally Zenned

Join Date:
Mar 2005
Location:
California
Posts:
628
Plugin Contributions:
0

Re: Free Shipping Options module, how to exclude some categories?

When you tried the code to exclude all subcategories, did you create the extra function file with the code in post #12 and put it in your extra functions folders?