Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Commit

Permalink
Better cart property check
Browse files Browse the repository at this point in the history
  • Loading branch information
cshold committed Jan 19, 2015
1 parent 2460732 commit 53b28d5
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions templates/cart.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,25 @@
For more info on line item properties, visit:
- http://docs.shopify.com/support/your-store/products/how-do-I-collect-additional-information-on-the-product-page-Like-for-a-monogram-engraving-or-customization
{% endcomment %}
{% for p in item.properties %}
{% unless p.last == blank %}
{{ p.first }}:

{% comment %}
Check if there was an uploaded file associated
{% endcomment %}
{% if p.last contains '/uploads/' %}
<a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
{{ p.last }}
{% endif %}

<br>
{% endunless %}
{% endfor %}
{% assign propertySize = item.properties | size %}

This comment has been minimized.

Copy link
@carolineschnapp

carolineschnapp Jan 19, 2015

Contributor

In Liquid, we don't use camel case usually, right?

properties_amount or properties_size might be better.

This comment has been minimized.

Copy link
@cshold

cshold Jan 19, 2015

Author Contributor

We don't really have a convention for it yet honestly. I'd prefer if we went camel case when possible, or even UpperCamel like we do for IDs. Thoughts @stevebosworth @mpiotrowicz?

This comment has been minimized.

Copy link
@carolineschnapp

carolineschnapp via email Jan 19, 2015

Contributor

This comment has been minimized.

Copy link
@cshold

cshold via email Jan 19, 2015

Author Contributor
{% if propertySize > 0 %}
{% for p in item.properties %}
{% unless p.last == blank %}
{{ p.first }}:

{% comment %}
Check if there was an uploaded file associated
{% endcomment %}
{% if p.last contains '/uploads/' %}
<a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
{{ p.last }}
{% endif %}

<br>
{% endunless %}
{% endfor %}
{% endif %}

<a href="/cart/change?line={{ forloop.index }}&amp;quantity=0" class="cart__remove" data-id="{{ item.id }}">
<small>{{ 'cart.general.remove' | t }}</small>
Expand Down

0 comments on commit 53b28d5

Please sign in to comment.