Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.2
Component:
Developer experience
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Feb 2012 at 17:40 UTC
Updated:
29 Feb 2012 at 21:40 UTC
Hi.
i want to alter the values in some of my product custom fields in every cron run.
I created a rule using react on event "Cron maintainance tasks" but i cant find any way to access commerce product entity.
Any ideas??
Thank you
Comments
Comment #1
rszrama commentedYou have to load them first using the "Fetch an entity" action, but I'd recommend against using Rules to build something like this in favor of a custom cron hook in a site-specific module. You'll be able to target your load query much more specifically so you aren't having to load every product on the site each cron.
Comment #2
frixos12 commentedHi and thank you for your post.
My problem is when using the "Fetch an entity action" the property value of the entity to be fetched doesn't have my entity's fields as an option.
How can i load my entity's fields since i cannot use conditions like entitys has field or entity exists by property?
Comment #3
frixos12 commentedComment #4
rszrama commentedYou have to loop over the return value from the "Fetch an entity" action and pass them entities one by one to a Rules component that includes the necessary conditions and the actions for processing the entity. That's the only way to get the "Entity has field" conditions in the "action" part of the Rule.