0

I have two content types - Review, and Business. Reviews have an entity reference field linking the review to the Business being reviewed. On the business page, I have fields that display the averages of the submitted reviews for different aspects of the Business. However, the average only updates itself when the node is saved. So, I need a way to automatically save the business page when a review referencing it is created. I'm assuming that the best way to go about doing this would be using Rules, but I am not sure what actions to assign to the Rules to make it tick. Any suggestions?

2 Answers 2

1

in rules (sorry the terminology is not exact) :

  • action : node save
  • condition : type = review
  • select the bussiness from the review
  • resave that business (you will have to force it probably)

or the same in a hook (node_api, operation save, nodetype review)

the best would probably be creating an agregated view end embedding that into your node (or attaching with a block, many possibilities)

2
  • Sorry if I'm being dense (which is a definite possibility) but it seems as though you are just restating my issue with the last two bullets of the solution. The issue is that I don't know how to tell rules to save the node that is referenced, so I don't know how to select the business from the review and resave the business.
    – Mrweiner
    May 14, 2012 at 22:41
  • Nevermind, I figured it out myself. Thanks for the help anyway. I'll post up the answer once I am allowed to by the system.
    – Mrweiner
    May 14, 2012 at 23:15
0

So I thought I had submitted an answer already, but apparently it didn't submit. So, here's the quick and dirty. Under content is of type select the type of content being saved. Next, under fetch entity by id, click on switch to data selctor under identifier. Next, enter node:your-reference-field:nid. Create another action, select save entity, and then select entity fetched, which was made available in the previous step.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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