I am using Drupal 7, the Ubercart and Rules module; I plan to use the Views Rules) module. I want to use the Rules module to automatically publish nodes that contain data from a Ubercart order.

I'm attempting to automate a few processes on my Drupal 7 site after the completion of an order with Ubercart. Upon completion of an order, I would like to automatically publish a content type that contains data from the order (price, customer/user, seller, product name, entity reference data, etc). I can create the rule to publish the content type, but I'm struggling to figure out how to get the data from the order into the content type.

My approach so far has been to tag the order upon completion of an order, then fetch the order data. However, when I drill down into data selectors, the values I need are not available. Furthermore, I'm not sure I would know how to get it loaded into the content type upon publish.

I've come across Views Rules module which, to my understanding, will allow me to define the values to fetch. I've created views that I can load into Rules, but it appears that the View will return all results of the view instead of the result I need upon completion of the order (maybe I'm wrong about this?)

I just need a nod in the right direction on how to accomplish this. I'm just not sure if my approach is right. I have the basics of Rules, and have only constructed very simple rules. I imagine what I want to accomplish will require a more complex construct of Rules. Any suggestions are greatly appreciated, particularly on how to use Views to accomplish what I need.

2 Answers 2


I don't understand most of this.. "publishing a content type?" You sure you don't mean "creating a node"?

Anyways, in conditions for the rule, choose "entity has field" for each field you need. This will allow you to use them in actions.

  • Hey Niall, "entity has field" is not really going to work here I think. mostly because the Rules Event here is probably something related to the "order", while the Rules Actions are like "set a data value" (or something like that) for fields in the "related" node. "Related" here really has to be understood like in a views relationship (I think). And that is also why using an appropriate view, combined with "Views Rules" is probably going to be the key to solve the (Rules) puzzle here. Get it? Feb 5, 2017 at 17:05

It seems that you're struggling (quite) a bit with how to use the Rules module to implement what you're looking for, together with the Views Rules module. Some details about the Views Rules module (from its project page):

Provides Views directly as Rules actions and loops to seamlessly use view result data.

If you're not familiar with Rules (either), the previous quote may seem a bit cryptic (it may make you think like "so what, how can this help me?"). Therefor some more details about how to move forward using these modules:

  1. Create a view (using Views) so that you have 1 Views result (row) with all the order details you want to be processed, whereas that view has fields (columns) for your price, product name, seller, etc. You'll need these View fields later on as values to be processed by your rule, "to get the data from your order into the content type", as in your question. Important: use a Views display type of "Rules".
  2. Create a custom rule in which you use the Views Rules module to iterate over each of these Views results in a Rules action, using the Rules technique known as a "Rules Loop". In your case it may well be that you only have 1 views result (row), but the general concept is that you have "a number" of rows.
  3. For each iteration step in your Rules loop, perform a Rules Action to "do your thing" (= get the data from the order in your content type). At that point you'll have all data from each column of your Views results available as so called Rules Parameters. So at that point it's a piece of cake to populate the various fields of your content type.
  4. The only remaining thing is to decide about the Rules Event to use for this rule to be triggered. But that's up to your own imagination (any Rules Event will do). Optionally, you may also want to add whatever extra Rules Condition(s), also up to your own imagination.

Easy, no?

Not the answer you're looking for? Browse other questions tagged or ask your own question.