灰色显示不可用的产品

  • 本文关键字:显示 灰色 prestashop
  • 更新时间 :
  • 英文 :


我希望商品信息中没有的商品以不同的颜色显示。理想情况下,它们将是灰色或透明的,以从可用的中脱颖而出。我怎样才能做到这一点?

https://medpak.com.pl/suplementy-diety/

首先,如果产品不可用,那么除非您在 prestashop 面板中设置允许订购不可用的产品,否则它不会显示在列表中 - 但是如果我仍然可以订购它们,为什么要让它们看起来不同呢?

无论如何,要实现您的目标:

  1. product-list.tpl行中找到单个产品的代码,并在元素的类值中添加一些代码,product-container下面添加一些代码,使其看起来像这样:

    <div class="product-container {if $product.quantity <= 0}product-grayed{/if}">...</div>
    
  2. 然后在你的 css 中添加:

    .product-grayed img {
        opacity: 0.5; // this code for transparent image
        filter: grayscale(100%); // this code for gray image
    }
    
  3. 使用添加的类product-grayed进行任何其他 css 更改

最新更新