0

I created a multiselect attribute with label featuredetails. I created a static block and called the feature.phtml file(a newly created phtml file) in it like:

<div id="tab3" class="tab">
      <p>{{block type="core/template" template="catalog/product/view/feature.phtml"}}</p>
</div>

The content of the phtml file is:

    <?php       
   $_prodID = Mage::registry('current_product')->getId();
   $_product = Mage::getModel('catalog/product')->load($_prodID );
?>

<div class="feature">

    <?php
        $Feature = explode(",",$_product->getResource()
        ->getAttribute('featuredetails')->getFrontend()
        ->getValue($_product));
        foreach($Feature as $key => $value): ?>
        <a href="<?php echo $_product->getProductUrl() ?>" ?>
            <?php echo "<img   src='".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."/wysiwyg/".trim($value).".png'/>"; ?>
       </a>

       <?php endforeach; ?> 
</div>

The content of the block will map the attributes with the media images.

But am getting error like: Fatal error: Call to a member function getFrontend() on boolean

Help me to resolve this error.

0

It looks like the attribute isn't created or attribute_code is mismatch. Please try to find attribute with attribute_code featuredetails in Attribute Grid.

Please check the following code with your attribute_code

$attributeInstance = Mage::getSingleton('eav/config')
    ->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'featuredetails');
var_dump($attributeInstance->getId());

As a result you should see attribute_id.

| improve this answer | |
  • should i include this in my code? – Ramya May 24 '16 at 6:13

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.