我想根据来自magento上的属性的值获取图像。如何显示来自属性magento的不同值的自定义图像
实施例:
Attribute > MyAttribute
Values > Nasa, Google, Linux
Images > Nasa.jpg, Google.jpg, Linux.jpg
Products >
Product Nasa < Get Nasa.jpg if is selected an attribute
Product Google < Get Google.jpg if is selected an attribute
Product Linux < Get Linux.jpg if is selected an attribute
该脚本是如果选择是,以显示。
<?php if($_product->getMyAttribute()): ?>
<img src="/path/to/the/image.jpg">
<?php endif; ?>
我自己找到了解决方案。在脚本下面。
<?php if ($_product->getAttributeText('myattribute') == "Text Inside"): ?>
<div id="some"><img src="image.jpg"></div>
<?php endif; ?>
如果你有答案写在答案部分......它也令其他人感到困惑 –