4
Answers
Vote up!
0
Vote down!

Product Scheduling - Schedule to disable/delete Product if the custom date field is in the past

I am looking to use a rule that whenever the cron is run, it will update the status of any products that has a custom date field set into the past.... so basically, I'm looking for a product (course) to expire on the site after the start time of the class pass (after a cron run). I currently have all the classes and time variations as separate products.

I'm not familiar with creating too many rules within Drupal, but I believe this is the way to go. I have looked all over for a solution, and even tried several ways myself, but I am coming up short. I would love to hear any ideas even if it doesn't involve rules. There is an easy way to unpublish content, but not products.

Here's what I got so far...

Event
Cron maintenance tasks are performed

Conditions
Entity exists by property
Parameter: Entity type: Commerce Product, Property:Status, Value:true

Data comparison
Parameter: Data to compare:????, Operator: is greater than, Data value:[site:current-date]

Actions
????

I can't figure out the data comparison parameter to get the custom field under Products: $field_date. I'm assuming you use php validation. And then in the actions I'm assuming you use a loop to fetch an entity by property and then save entity? Possibly in a loop...?

Any and all help would be appreciated! Thanks!

Asked by: bwoelkers
on July 3, 2012

4 Answers

Vote up!
0
Vote down!

According to Schedule's Project Page it is for Nodes only. Ideally in a store situation, having the product disabled as opposed to unpublished is the way to go... Did you ever get this figured out? I am trying to create a Rule that runs with cron to compare a custom date field to the current date and time and for some reason it won't let me select any related fields, even after adding the 'Entity Has Field' option.

Any insights/recipes?

Thanks;

-Ryan

Answer by: rbrownell
Posted: Apr 23, 2013
Vote up!
-1
Vote down!

Use Scheduler to unpublish de product display of your product at the specified date.

Answer by: netol
Posted: Jan 16, 2013