我希望商品信息中没有的商品以不同的颜色显示。理想情况下,它们将是灰色或透明的,以从可用的中脱颖而出。我怎样才能做到这一点?
https://medpak.com.pl/suplementy-diety/
首先,如果产品不可用,那么除非您在 prestashop 面板中设置允许订购不可用的产品,否则它不会显示在列表中 - 但是如果我仍然可以订购它们,为什么要让它们看起来不同呢?
无论如何,要实现您的目标:
-
在
product-list.tpl
行中找到单个产品的代码,并在元素的类值中添加一些代码,product-container
下面添加一些代码,使其看起来像这样:<div class="product-container {if $product.quantity <= 0}product-grayed{/if}">...</div>
-
然后在你的 css 中添加:
.product-grayed img { opacity: 0.5; // this code for transparent image filter: grayscale(100%); // this code for gray image }
- 使用添加的类
product-grayed
进行任何其他 css 更改