I'm setting up an drupal commerce shop and I'd like to be able to use a conditional statement to show a product as either:

1 - pre-order
2 - in stock
3 - out of stock

commerce can handle the in stock / out of stock part via a field, but I haven't been able to figure out how to combine that with another field to setup a conditional pre-order option. Basically, what I was hoping to do was,

1 - add a pre-order field to my products
2 - give that field 2 options "yes" or "no"
3 - setup a conditional action in views that if "yes" is selected will display "pre-order" and if "no" is selected it will revert to the above mentioned "stock" field.

Does this sound possible with Views PHP?

Any help will be greatly appreciated. Thanks!

Comments

streever’s picture

I would suggest adding some fields--in stock should be a CCK field with a "yes" "no" option. Put in stock in as a field (in views) and exclude the output.

Add a "php field" which says,
"Does in stock == yes echo "in stock" else echo "out of stock""

You'll have to use a standard if/else php statement.

Liam Morland’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.