Vote up!
Vote down!

Views PHP sorting rule about stock

I want to sort a view so that all the products that are not available be at the end. I do not want, however, to sort the available products by stock (say, alphabetically).
I asked a queation about that at http://drupal.stackexchange.com/questions/70196/how-to-sort-a-view-so-th...

and have been wisely suggested to look at the at Views PHP module. However, I can't access the stock value form Views PHP. What should the rule be like?

Asked by: Ivan H
on April 17, 2013

1 Answer

Vote up!
Vote down!

I have not implemented this idea but this might help you.Add a hidden field to your product and give it a text value like A for those on stock and value B for those not in stock. Now u can sort by this field and i guess you might get what you wanted.I guess this might work.

Answer by: __saurav
Posted: Apr 18, 2013


Yes, sure, though I this is so simple that I wish it could be done automatically just by the sorting mechanisms.

- Ivan H on April 18, 2013