Skip to content

Instantly share code, notes, and snippets.

@brianweiner
Last active December 11, 2015 00:09
Show Gist options
  • Save brianweiner/4514454 to your computer and use it in GitHub Desktop.
Save brianweiner/4514454 to your computer and use it in GitHub Desktop.
search_filter_partial - size only
<h4>Size</h4>
{% set option_values = category ? my_cat.list_unique_product_option_values('Size') : method('Shop_CustomAttribute','list_unique_values','Size') %}
{% set selected_size = selected_options['Size'] ? selected_options['Size'] : [] %}
<input type="hidden" name="option_names[]" value="Size"/>
<select style="display:none" id="size-select" class="search-filter-select" name="option_values[]">
<option value=""><strong>Choose Size</strong></option>
{% for value in option_values %}
<option
{{ option_state(value, attribute(selected_options, 'Size')) }}
value="{{ value }}">{{ value }}</option>
{% endfor %}
</select>
{% for value in option_values %}
<span id="{{value}}" data-value="{{value}}" data-select="size-select" {{ selected_size == value ? 'class="filter-option size-option search-filter-selection"' : 'class="filter-option size-option"' }}>{{value}}</span>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment