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; ?>