-
-
Save lmartins/068e1b90f7b64cf45091e532fa7a3f00 to your computer and use it in GitHub Desktop.
Reorder module to drop inside collection.liquid - may need CSS love. http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/add-a-reorder-drop-down-menu-to-a-collection-page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<label for="sort-by">Sort by</label> | |
<select id="sort-by"> | |
<option value="manual">Featured</option> | |
<option value="price-ascending">Price: Low to High</option> | |
<option value="price-descending">Price: High to Low</option> | |
<option value="title-ascending">A-Z</option> | |
<option value="title-descending">Z-A</option> | |
<option value="created-ascending">Oldest to Newest</option> | |
<option value="created-descending">Newest to Oldest</option> | |
<option value="best-selling">Best Selling</option> | |
</select> | |
</div> | |
<script> | |
Shopify.queryParams = {}; | |
if (location.search.length) { | |
for (var aKeyValue, i = 0, aCouples = location.search.substr(1).split('&'); i < aCouples.length; i++) { | |
aKeyValue = aCouples[i].split('='); | |
if (aKeyValue.length > 1) { | |
Shopify.queryParams[decodeURIComponent(aKeyValue[0])] = decodeURIComponent(aKeyValue[1]); | |
} | |
} | |
} | |
jQuery('#sort-by') | |
.val('{{ collection.sort_by | default: collection.default_sort_by | escape }}') | |
.bind('change', function() { | |
Shopify.queryParams.sort_by = jQuery(this).val(); | |
location.search = jQuery.param(Shopify.queryParams).replace(/\+/g, '%20'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment