How can i change the image style for a product (variation) when the stock level has reached "Out of stock" level? Would be great to add a badge to the product image saying "SOLD".
Commerce Stock UI
Commerce Simple Stock
Commerce Simple Stock Rules
Imagecache Actions
Imagecache Canvas Actions
Field formatter conditions
Field formatter settings API
Or run this drush command:
$ drush en imagecache_canvasactions, commerce_stock_ui, ffc -y
** Don't forget to manually enable Commerce Simple Stock and Commerce Simple Stock Rules
3) Configure your product so it has images and real stock values
4) Create a new image style
5) Add a rule that reacts on the event "field is being rendered" and has a condition of "data comparison" on the product's commerce_stock field and an action of "change image style."
6) Change the image style formatter to have a condition of "use an event rule" and then select your new rule that you created.
Comments
Changing field formats based on stock
1) Download the following modules:
https://drupal.org/project/commerce_stock
https://drupal.org/project/ffc
https://drupal.org/project/field_formatter_settings
https://drupal.org/project/imagecache_actions
2) Enable the following modules:
Commerce Stock UI
Commerce Simple Stock
Commerce Simple Stock Rules
Imagecache Actions
Imagecache Canvas Actions
Field formatter conditions
Field formatter settings API
Or run this drush command:
$ drush en imagecache_canvasactions, commerce_stock_ui, ffc -y
** Don't forget to manually enable Commerce Simple Stock and Commerce Simple Stock Rules
3) Configure your product so it has images and real stock values
4) Create a new image style
5) Add a rule that reacts on the event "field is being rendered" and has a condition of "data comparison" on the product's commerce_stock field and an action of "change image style."
6) Change the image style formatter to have a condition of "use an event rule" and then select your new rule that you created.
7) Profit!
Anyone got this to work in
Anyone got this to work in Commerce Kickstart v2? I can't seem to do this. Very weird :-(
Yeah, it works in ck v2.
Yeah, it works in ck v2.