我为Magento中的标签添加了一个新属性,并修改了文件labels. php。如果在后端将属性设置为YES,并且商品是销售商品,那么我希望显示不同的标签。代码如下,但我没有得到任何结果:
if (($isSale == true) && ($product->getAttributeText('Clearance') == YES))
{
$html .= '<span class="sticker-wrapper top-right"><span
class="sticker sale">' . $this->__('Clearance') . '</span>
</span>';
}
你知道我做错了什么吗?
Magento存储是/否值为1/0。试着改变你的状况:
if (($isSale == true) && ($product->getAttributeText('Clearance') == "YES"))
if (($isSale == true) && ($product->getAttributeText('Clearance') === "1"))