【发布时间】:2018-05-05 16:07:39
【问题描述】:
我正在开发一个经验非常有限的 Shopify (slate) 主题。我需要添加一些我在图像上管理过的类,但找不到在 <h2 class="mosaic__title p-name">{{ item.title | link_to: item.url }}</h2> 中包含的锚点上执行此操作的方法。
我还有一些价格,在它之前注入了诸如“On Sale from”之类的文字。我不知道这是如何添加或如何删除它的。这是一个例子:
<del>{{ item.compare_at_price | money }}</del>
{% assign sale_price = item.price | money %}
{{ 'products.product.on_sale_from_html' | t: price: sale_price }}
我已经尝试删除 .on_sale_from_html 和 t: price: sale_price 但这不起作用/它坏了。
任何人都可以就此提出建议吗?谢谢!
完整部分代码供参考:
<div class="mosaic__caption">
<h2 class="mosaic__title p-name">{{ item.title | link_to: item.url }}</h2>
{% if item.object_type == 'product' %}
<p class="mosaic__value">
{% if item.compare_at_price > item.price %}
{% if item.price_varies %}
<del>{{ item.compare_at_price | money }}</del>
{% assign sale_price = item.price | money %}
{{ 'products.product.on_sale_from_html' | t: price: sale_price }}
{% else %}
{{ 'products.product.on_sale' | t }}
<data itemprop="price" class="p-price">{{ item.price | money }}</data>
{% endif %}
<data class="visually-hidden p-price">{{ 'products.product.regular_price' | t }}</data>
{% else %}
{% if item.price_varies %}
{% assign price = item.price | money %}
<data itemprop="price" class="p-price">{{ 'products.product.from_text_html' | t: price: price }}</data>
{% else %}
<data itemprop="price" class="p-price">{{ item.price | money }}</data>
{% endif %}
{% endif %}
{% unless item.available %}
{{ 'products.product.sold_out' | t }}
{% endunless %}
</p>
{% else %}
<p>{{ item.content | strip_html | truncatewords: 50 }}</p>
{% endif %}
</div>
【问题讨论】: