1

I want to display attribute option image on product detail page.

I have a variable that returns an array of option ID, but i need the corresponding image to display the image:

<?php echo $_product->getProductTools(); ?>

I've tried this code but don t know how to replace 4550 by the result of the variable, and also the output should be an image(or list of image) not the url of image

$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql        = "SELECT `image` FROM `eav_attribute_option` WHERE `option_id` = 4550";
$rows       = $connection->fetchAll($sql); //fetchRow($sql), fetchOne($sql),...
Zend_Debug::dump($rows);
  • what exactly $_product->getProductTools(); gives? if it gives array then why you have used echo? – Gopal Patel Nov 5 '16 at 7:47
  • yes that is an array – César MLBW Nov 7 '16 at 22:02
  • Could you help me solve this? – César MLBW Nov 10 '16 at 16:24
0

i ve tried this but it doesn t work: $producttools = $_product->getProductTools();

$connection = Mage::getSingleton('core/resource')->getConnection('core_rea‌​d'); $sql = "SELECT image FROM eav_attribute_option WHERE option_id IN $producttools"; $rows = $connection->fetchAll($sql); //fetchRow($sql), fetchOne($sql),... Zend_Debug::dump($row

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.