Possible Duplicate:
Displaying all products on sale with exp:resso store?

I want to have a page on our store that displays only items that are on sale. What's the most efficient way to write this query?


You should be able to do the following

{exp:store:search search:on_sale="yes" search:in_stock="yes"}
    <!-- channel entry details -->

to only show products that are On Sale and In Stock as referenced in the docs here. The search tag would probably be better then writing your own query as it extends the channel entries tag so you would be able to use any of your custom fields also.

  • Ah, I wasn't aware of that tag. I think I saw it in the docs previously and thought it had more to do with doing an actual search rather than filtering store products. Follow up question: is there any way to sort by whether an item is on sale or not? I want to display first non-sale items followed by sale items, without writing 2 separate queries. – kscotbarr Feb 5 '13 at 13:33
  • Also, if the search query returns no results, any way to conditionally show content? As in: {if no_results} or {if total_results == ""} I can't seem to get that working. – kscotbarr Feb 5 '13 at 13:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.