开发者

Check if term exists and create a node with rules

开发者 https://www.devze.com 2023-04-13 07:49 出处:网络
I actually have 2 questions regarding Drupal 7 and Rules.: How to check if a term exists with rules How to make a new node and forward to the node entry with rules

I actually have 2 questions regarding Drupal 7 and Rules.:

  1. How to check if a term exists with rules
  2. How to make a new node and forward to the node entry with rules

Let me sketch the scenario first and then explain in more detail:

Im currently creating a simple stock program to be used with a barcode scanner. The barcodes are stored in a taxonomy tree. I have 2 content types, a scan and a product.

A user is always presented with the scan content type (one big text input) that the barcode scanner will fill in and submit.

Drupal then checks to see if the scanned barcode is present in the taxonomy.

If it is not it creates a new node for product and lets the user fill in all the details about this barcode. If the term does exist, only the scan node is saved (which has a counter +1 or -1) so that I can later use views to see how many products went in or out.

Im trying to do this with rules...without success.


So my first question is: How can I check if a term already exists in a vocabulary? I think it needs to be done with a drupal native function in a php rule, but cannot find this function. Am I missing something?

My second question is about Rules entities.

I'm trying to create a node with a rule. When a term does not exist, rules needs to create a new product node and show it to the user so that they can fill in some detail fields and then save it.

I'm trying to do this with Rules -> Create new entity. As "Entity type" I choose "Node" and as "Content type" I choose my product content type. Then I also need to fill in a title. There is where it goes wrong. I tried to put every type of data or string inside this Value fi开发者_开发百科eld of Title and Rules accepts it and saves the rule. But every time the rules failes creating the node with the following error message:

Unable to create entity node": Invalid data value given. Be sure it matches the required data type and format.

How can I effectively create a new node of a certain content type and present it to the user for further finishing, all with rules?

I hope I could explain it clearly :)

Thank you :)

0

精彩评论

暂无评论...
验证码 换一张
取 消