shopify单击不同的按钮将运行不同的液体代码 [英] shopify click on different button will run different liquid code

查看:141
本文介绍了shopify单击不同的按钮将运行不同的液体代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户单击类名称为"3-col"的按钮,它将执行以下代码:"{%Assign products_per_row ="3"%}.

If a user click on a button which has class name: '3-col', it will execute the following code: '{% assign products_per_row = "3" %}'.

,如果用户单击"4-col"按钮,它将执行以下代码:"{%Assign products_per_row ="4"%}.

and if a user click on a '4-col' button, it will execute the following code: '{% assign products_per_row = "4" %}'.

但是下面的代码不起作用.

However the code below doesn't work.

我已经研究了所有方法来做到这一点,但我没有.任何建议表示赞赏.谢谢!

I have researched all ways to do that, but I couldn't. Any advice is appreciated. Thanks!

<button class='3-col' onclick="prod3()"></button> 
<button class='4-col'onclick="prod4()" ></button> 
{% include 'product-loop' with settings.collection_sidebar %}


<script type="text/javascript">
 function prod3(){ 
            {% assign products_per_row = "3" %} 
        }
function prod4(){ 
            {% assign products_per_row = "4" %} 
        }

</script>

推荐答案

  • 没有办法像你一样做.
  • 但是我给你相关的提法:
    • 请参阅链接 https://full-the-style.myharavan.com/collections /all ;然后单击左侧栏上的过滤器项,然后右侧栏必须根据您的选择更改某些项.
    • 在Chrome上,您可以按F12,选中网络"标签,然后再次单击左侧栏中的过滤器项;确保您可以看到请求"/search?...view=grid_and_control"; => 通过将请求发送到指定的搜索页面模板"来解决您的问题.
      • There's no way to do like yours.
      • But I give you relevant-mention:
        • Refer the link https://full-the-style.myharavan.com/collections/all; then click a filter-item on the left-bar, then right-bar must change some items following your choose.
        • On Chrome, you can press F12, check Network tab, click a filter-item on left-bar again; make sure that you can see request "/search?...view=grid_and_control"; => solve your problem by sending request to a specified search-page TEMPLATE.
          • 在Shopify管理员/主题内,创建2个搜索页面模板:"search.3col.liquid"和search.col.4col.liquid.
          • 在每个按钮上,您都可以请求具有2个视图的搜索页:"/search?view = 3col"& "/search?view = 4col"
          • 然后,您可以使用HTML,CSS进行任何操作,当然也可以使用上面2个搜索页面上的液态代码进行操作.

          PS:上面的网站基于Haravan.com,它就像Shopify.com(创建您自己的商店,使用流动代码自定义主题...)

          PS: The site above based on Haravan.com, it just likes Shopify.com (create your own store, customize theme with liquid code... )

          这篇关于shopify单击不同的按钮将运行不同的液体代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆