Fetch Dropdown Selected Value on “list.phtml”
-
02-10-2020 - |
Question
I am created one custom dropdown attribute , now i want to fetch dropdown selected value display in "list.phtml".
Solution
//just put this code after product name
<?php
$attrvalue=$_product->getIdols();//get your attribute for particular product
$productModel = Mage::getModel('catalog/product');
$attr = $productModel->getResource()->getAttribute("idols");
if ($attr->usesSource()) {
$idols_label = $attr->getSource()->getOptionText($attrvalue);
}
?>
<div class="idols">
<?php echo $idols_label;?>
</div>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange