First of all, thank you for this module. I just discovered it today while trying to find a solution for my problem and it looks really useful.
My problem is this:
I need to set a term to a product when the product has a price within a certain range. I need to have it update this term should the user update the price. This seems simple to me using this module, but for some reason the rule I have built does not function.
My rule is set up as follows:
ON
After updating existing content
IF
Saved content is product
AND
Numeric comparison (explained below)
DO
Load a term (0-399)
Assign a term to content (product)
The only part of this that I imagine could be going wrong is the numeric comparison. In the comparison I have a "Number 1 is equal to Number 2" setup where number 1 is defined as the token "[node:sell_price]" and number to is defined as "[0-3][0-9][0-9]" (a regular expression).
Am I not allowed to drop a regular expression right into the "number 2" field like this? Incidentally, I also tried "/[0-3][0-9][0-9]/".
This is supposed to set the term Price 0 - 399 when a product node is created or updated with a value in that range, but that isn't happening.
Does anyone have an idea of what is going on here?
Comments
For those who find this in
For those who find this in the future:
The answer to my regex question is answered here http://drupal.org/node/917330
However, note that this setup will add a term without removing whatever term is currently set. This is bad because you'll start getting piles of terms when there should be only one (highlander).
Instead of just adding a term, the rule needs to replace one. I have asked a question concerning this specifically at http://drupal.org/node/917476 . There is no response as of right now, but there probably will be by the time someone else has this problem.
Edit:
I used the code at http://drupal.org/node/919962 in order to remove terms from a specific category. I also had to php code my regular expressions (regex) because rules seems to automatically escape backslash characters present in a regex. So the logic was a pair of rules, one which remove all terms in the vocab and another which set the term all based on regex pattern matching.
@melchoir55: Thanks for
@melchoir55: Thanks for posting the details on this! Your writeup has greatly helped me build my rule to add a term to a newly created node. Cheers!