Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Forum

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Categories filter doesn't work 22 Jan 2016 09:55 #1

  • gutbetucht
  • gutbetucht's Avatar Topic Author
Hello,

I just installed the "Premium" version and tried to implement a filter which, reduces shipping costs if you only order one product of certain categories, say hats and dvds. And if you order more than a product you pay the normal shipping cost (11).

Now I added this filter:
Name=""; articles<=1;contains_any(Categories,hat,dvd); shipping=3
Name=""; shipping=11

It works perfectly with the number of articles, but it somehow doesn't look at categories at all. So it shows me shipping cost of 3.- if there's one article in the basket and 11.- if there's more than one. But it doesn't matter from which category this article is, so it also shows 3.- if there's only a book in the basket.

Can you tell me where the problem is?

Categories filter doesn't work 29 Jan 2016 11:17 #2

Dear Gutbetucht,
First, if you don't want to display a rule name to the user, you don't need to give a Name="" at all.
Second, please note that the category names in WooCommerce are strings, so you have to wrap hat and dvd in quotation marks:
articles<=1;contains_any(Categories, "hat", "dvd"); shipping=3
shipping=11

Best regards,
Reinhold

Categories filter doesn't work 29 Jan 2016 14:13 #3

  • gutbetucht
  • gutbetucht's Avatar Topic Author
Dear Reinhold,

thank you for your answer.
contains_any(Categories,"Weiteres"); articles<=1; shipping=noshipping
shipping=9

But sadly the filter still doesn't work.Weiteres is the name of the Categorie.
Any ideas?

Thank You
Lukas

Categories filter doesn't work 29 Jan 2016 14:38 #4

Dear Lukas,
Can you please try prepending "Condition=" to the contains_any function:
Condition=contains_any(Categories,"Weiteres"); articles<=1; shipping=noshipping
shipping=9

Best regards,
Reinhold

Categories filter doesn't work 06 Feb 2016 13:54 #5

  • ivo
  • ivo's Avatar

Dear Lukas,
Can you please try prepending "Condition=" to the contains_any function:
Condition=contains_any(Categories,"Weiteres"); articles<=1; shipping=noshipping
shipping=9

Best regards,
Reinhold


Hi ,

I am experiencing the same problem
VM 3,0,8 here

tried : Name=ACTION ; contains_any (Categories, 1); Weight>25; Shipping=0

it does not check the categories in the cart, but no error

now i tried

Name=ACTION ; Condition=contains_any(Categories,"freeshippingcat"); Weight>25; Shipping=0

an i receive the error
Evaluation yields unknown value while evaluating rule part 'contains_any(Categories,'.

on checkout


Wich rule should i use to get this to work?

Categories filter doesn't work 06 Feb 2016 14:12 #6

  • gutbetucht
  • gutbetucht's Avatar Topic Author
Hello Ivo,

I didn't solve this problem yet, or let's say I've given up on using a category filter.

My solution to this problem was, ussing a shipping class filter and giving the categories I wanted to be included the needed shipping class.

condition=contains_any(ShippingClasses,"klein"); articles<=1; shipping=3
shipping=11

But if there's a official solution to this problem, this would be nice aswell.
Lukas

Categories filter doesn't work 30 Mar 2016 01:01 #7

  • gutbetucht
  • gutbetucht's Avatar Topic Author
Hello Reinhold,

I'm redoing a couple of things on my website and had to change some conditions on my shipping rules.
Somehow now I'm experiencing the same problems I had in January, using the contains_any function with categories or shippingclasses.
Any ideas?
Condition=contains_any(ShippingClasses,"klein"); articles==1; shipping=3
Condition=contains_only(ShippingClasses, "klein"); articles<=5; shipping=9
Condition=contains_any(ShippingClasses, "klein"); articles<=3; shipping=9
articles<=1; shipping=9
amount>175; shipping=2
shipping=11

Categories filter doesn't work 02 Apr 2016 19:57 #8

Dear Gutbetucht,
I have tried your rules on a test installation and they worked just like expected:
  • one item from the shipping class with slug "klein" has shipping cost 3
  • up to five items from the shipping class "klein" cost 9
  • up to three items, from which at least one is from the shipping class "klein", cost 9
  • Any other single article costs 9
  • All other orders are either 2 (for order amounts above 175) or 11

Are you sure that your shipping class has the slug "klein" (notice that the plugin uses the SLUG of the shipping class, not the display name)? Also, please make sure that you used the same capitalization (i.e. in your case all lower case) in the SLUG.

Best regards,
Reinhold

Categories filter doesn't work 07 May 2016 01:30 #9

  • gutbetucht
  • gutbetucht's Avatar Topic Author
Hello Reinhold,

sorry for not answering. Somehow by magic it started working after your answer.
But since a couple of days the argument contains_only doesn't seem to work. If I change the argument to contains_any it works.
amount>175; shipping=2
Condition=contains_any(ShippingClasses,"klein"); articles==1; shipping=3
Condition=contains_any(ShippingClasses, "klein"); articles==2; shipping=6
Condition=contains_only(ShippingClasses, "klein"); articles<=5; shipping=9
Condition=contains_any(ShippingClasses, "klein"); articles<=3; shipping=9
articles<=1; shipping=9
shipping=11

Thanks for your help!

Categories filter doesn't work 14 May 2016 18:08 #10

Dear Gutbetucht,
Great to hear that it started working.

Regarding the contains_any vs. contains_only: contains_any works just fine here. Have you maybe added a second category to your test products? contains_only works by compiling the list of all categories of all products in the purchase and then checking that against the given categories. It does not wor by checking whether each product has at least one of the categories. So, if one product has one other category, then contains_only no longer matches.

Best regards,
Reinhold Kainhofer

Categories filter doesn't work 15 May 2016 20:40 #11

  • gutbetucht
  • gutbetucht's Avatar Topic Author
Hello Reinhold,

thank you very much. I found the mistake thanks to your hint.
The problem was, I was filtering by Shipping Classes and I only added a ShippingClass to the group of articles that I wanted to include, but all the articles I wanted to exclude, didn't have a shipping class, so they didn't conflict with the rule contains_only.

Now my only problem is, that I have to trust my partner, to allways add shipping classes to every article he adds to the shop.
Or do you have some kind of trick?

THANKS!
Lukas

Categories filter doesn't work 20 May 2016 18:09 #12

Dear Gutbetucht,
Great to hear that you found the cause of your issue.

Unfortunately, I don't know any trick to ensure all articles have a shipping class set. A while ago I thought about adding a function like any_product and all_products, which would check whether one or each product fulfills a given condition, but then I never continued that idea...

Sorry,
Reinhold
  • Page:
  • 1