Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
snippets:receipt:conditional_content [2014/10/01 04:52] – foxyjosh | snippets:receipt:conditional_content [2017/04/26 07:02] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
---- dataentry snippet ---- | ---- dataentry snippet ---- | ||
- | type : snippet | + | type : snippet # do not change this line |
- | category | + | category |
- | name : Conditional Content | + | name : Display |
- | description | + | description |
- | versions_tags : 2.0 | + | versions_tags : 2.0 # compatible versions ( always use the dots between the numerals e.g 0.6.0 or 0.7.1 ) |
- | reference_url : | + | reference_url : # External link |
- | tags_tags | + | tags_tags |
- | date_dt | + | date_dt |
---- | ---- | ||
- | dkfjlaskdjf | + | |
+ | |||
+ | ====== Display Conditional Content | ||
+ | |||
+ | Using the sample code below, you can display custom html, javascript, etc. based on any criteria. For example, set parameter as false if specific product category is found: | ||
+ | |||
+ | < | ||
+ | {% if context == ' | ||
+ | |||
+ | {% set candy = true %} | ||
+ | |||
+ | {% for item in items %} | ||
+ | {% if item.category == ' | ||
+ | {% set categoryFound = false %} | ||
+ | {% endif %} | ||
+ | {% endfor %} | ||
+ | |||
+ | {% if categoryFound %} | ||
+ | < | ||
+ | {% endif %} | ||
+ | |||
+ | {% endif %}{# context == receipt #} | ||
+ | </ |