Open ghost opened 11 years ago
Your logic is broken, to acheive what you want you need to have an if
statement for else
to work. You need to have something like:
if
there are products, then
for
each product show some product information
else
tell me there are no products
In liquid (based on shopify), it could look like this:
{% if collection.products.size > 0 %}
{% for product in collection.products %}
{{ product.name }}
{% endfor %}
{% else %}
No products found
{% endif %}
Well.. Since this is based on liquid it should work... I understand there is a more correct way of doing it.. But in the original liquid you can do it like i said without making an if statement
On 24 apr 2013, at 18:41, chrstphrknwtn notifications@github.com wrote:
Your logic is broken, to acheive what you want you need to have an if statement for else to work. You need to have something like:
if there are products, then for each product show some product information else tell me there are no products
In liquid (based on shopify), it could look like this:
{% if collection.products.size > 0 %} {% for product in collection.products %} {{ product.name }} {% end for %} {% else %} No products found {% endif %} — Reply to this email directly or view it on GitHub.
sorry, my mistake... the way you describe is indeed correct, and insomuch a bug for this php port.
{% for product in product %} {{ product.name }} {% else %} No products found {% endfor %}
does not work... would be great if could have that!