可以在Shopify中完成集合的用户分类系统吗?

时间:2012-09-28 19:12:37

标签: shopify

在Shopify中,一个集合可以有一个默认的排序顺序,这很棒。但有没有办法在呈现集合的产品列表之前更改默认排序顺序?我想要实现的是在页面上放置一个“排序依据”下拉菜单,允许客户按价格,品牌,最畅销商品,按字母顺序等对当前列表进行排序,就像许多现代购物车一样在那里。

4 个答案:

答案 0 :(得分:0)

集合是提前排序的,而不是动态排序,以便页面加载速度更快。

您可以使用相同的产品创建多个集合,但具有不同的排序。然后,您可以根据用户输入导航到相关集合。

答案 1 :(得分:0)

现在有一个应用程序: https://apps.shopify.com/power-tools-sort-selector

*免责声明 - 我是开发人员:)

答案 2 :(得分:0)

我们最近添加了在店面上动态对您的集合进行排序的功能(在您只能在后端按一个订单对集合进行排序之前。

文档: http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/add-a-reorder-drop-down-menu-to-a-collection-page

前代码: https://gist.github.com/carolineschnapp/11352987

答案 3 :(得分:0)

如果您想避免支付应用程序 - 可能会也可能不会按照所需的选择数量复制每个集合 - 使用/调整以下代码:

  <script>
    // jquery is already running on the site, so we use it to check the document is ready
    $(document).ready(function() {
        // Identify a Select Option from the value in the URL query text
        // Where this exists as an Option Value, add the 'selected' attribute to the Option
        // This ensures that when the page reloads the current option will be showing
        $("#selectSort option[value='{{collection.sort_by}}']").attr('selected', true);
    });
  </script>

  <div>
    <!-- 
    The Select Tag watches for a change, then pushes a new window.location using the value
    of the Option selected by the user
    -->
    <select id="selectSort" onchange='window.location="{{ collection.url }}?sort_by=" + this.value'>
      <option value="price-ascending">Price (lowest first)</option>
      <option value="price-descending">Price (Highest first)</option>
      <option value="title-ascending">A-Z</option>
      <option value="title-descending">Z-A</option>
      <option value="created-descending">Latest Addition</option>
      <option value="best-selling">Most Popular</option>
    </select>
  </div>