0

Hello i created custom product attribute with Yes/No Value. for Product Information Page. If attribute Value Is Yes Then Display Products Details. But Whenever I Call, getAttributeText displayes null. I dont'd know what is the error.

i created one phtml file call special_product. in this file i call attribute. but its not work.

pls help me.

how to load product details if attribute value is "Yes"?

  • please share the phtml file – WISAM HAKIM Apr 23 '18 at 14:43
0

Did you try something like that ?

$product = Mage::getModel('catalog/product')->load($productId);
$value = $product->getResource()->getAttribute('your_attribute')->getFrontend()->getValue($product);
0

First check frontend property value like Used in Product Listing set to yes also set Visible on Product view page on Frontend to yes. where you created the attribute.

If above value is yes then you can call attribute value like this:-

<?php echo $_product->getAttributeText('custom attribute'); ?>

and as per your requirement I think you have to set if condition into your product page. like below:-

    if($_product->getAttributeText('custom attribute')=='yes'){

        your product details code.....
    }

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.