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 ...
Views: 6,157
Oba-san
Check the /cache directory and ensure you have no error logs being generated on this ...
New Zenner
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.
New Zenner
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.
Oba-san
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;
}
New Zenner
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.
Oba-san
Did you change the '10' to '108' or whatever master_categories_id that you are testing? :unsure:
Totally Zenned
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.
New Zenner
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?
Oba-san
You could zip your Free Shipping Options freeoptions shipping module and add it as an attachment so we can see what might be happening ...
Totally Zenned
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?
Tell staff why this post should be reviewed.