Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

showing a link if an attribute is set to “yes”
 
dolcezza
Jr. Member
 
Total Posts:  13
Joined:  2008-11-08
 

I am trying to show some thext and a link in the product page only if attribute is set to yes, but I cannot get it working.
I made an attribute called custom_art in the admin.

I edited catalog.xml:

<reference name="product_list">
<
action method="addAttribute"><attribute>custom_art</attribute></action>
</
reference>

I added things from different threads in here.

If I put this in my view.phtml, it appears on the front end as /yes. so it is finding the attribute:
<?php $_product->load($_product->getId()); ?>\
<?php echo $_product->getResource()->getAttribute('custom_art')->getFrontend()->getValue($_product); ?>

But this doesn’t work
Here is my view.html:

<?php // custom_art ?>
        
<?php if ($_product->getData('custom_art')): ?>
            <?php $_custom_art
$_product->getResource()->getAttribute('custom_art')->getFrontend()->getValue($_product); ?>
                <?php 
if ($_custom_art=="1"){ ?>
                        
<img src="<?php echo $this->getSkinUrl('images/btn_mini_search.gif') ?>" alt="More info"/>
                
<?php } else { ?>
                        
<img src="<?php echo $this->getSkinUrl('images/media/color-ivory.gif'); ?>"/>
              
<?php } ?>
        <?php 
endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top