我想根據來自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; ?>
如果你有答案寫在答案部分......它也令其他人感到困惑 –