window.processing = true;

Shop

Not sure where to start? Help me buy

window.sortBy = "best-selling";

no matches

window.productCardList = []; if(window.sortBy == 'price-ascending' || window.sortBy == 'price-dec') { callSortingFunction(); } function callSortingFunction() { if(window.processing) { setTimeout(function() { callSortingFunction(); },1000); } if(window.processing == false && window.sortBy != 'created-descending') { var sorted_items = getSorted('.card-product', 'data-sort', window.sortBy); $('.listing-shop__inner').html(sorted_items); } } function getSorted(selector, attrName, ascordesc) { return $($(selector).toArray().sort(function(a, b){ var aVal = parseInt(a.getAttribute(attrName)), bVal = parseInt(b.getAttribute(attrName)); if(ascordesc == 'price-ascending'){ return aVal - bVal; } if(ascordesc == 'price-dec'){ return bVal - aVal; } })); }