gpt4 book ai didi

javascript - Prestashop:修改mailalert模块,使产品数量更加可见

转载 作者:行者123 更新时间:2023-11-28 04:49:40 25 4
gpt4 key购买 nike

我希望在订单确认邮件中显示更多可见的产品数量。

我添加

 <td style="padding:0.6em 0.4em; font-weight: bold; text-align:center;"><big><big>'.(int)$product['product_quantity'].'</big></big></td>

mailalerts.php 内部

但我想优化它。

我想根据单元格的值更改单元格内的文本颜色。

如果数字是 1 应该是黄色如果数字 >1 应为红色我找到了这段代码,但我无法在我的文件中使用它,谢谢

 $('#mytable tr td').each(function(){

if($(this).text() > 1)$(this).css('background-color','red');
});

谢谢

最佳答案

您可以使用 ternary conditional 设置内联连接:

<td style="padding:0.6em 0.4em; text-align:center;' . ((int)$product['product_quantity'] == 1 ? "text-color: yellow;" : "text-color: red;") . '"><big><big>'.(int)$product['product_quantity'].'</big></big></td>

希望有帮助。

关于javascript - Prestashop:修改mailalert模块,使产品数量更加可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43040557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com