Custom Yes/No Product Attribute Works on Product Page but Not on Category Page

attributescategoryproducttemplate

I have a yes/no attribute used in product to output some text and it works fine:

<?php if ($_product->getAttributeText('sale_text') == "Yes"): ?>
    <?php 
        $day = strtotime('friday this week'); 
        echo " - On Sale Through " . date('m/d/Y', $day); 
    ?>
<?php endif; ?> 

However, when outputting yes/no attribute label on the category page (list.phtml) with the following code, I'm getting a "No" for all products even though I have several products set as "Yes":

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

Any idea what the issue is and how to fix?

Best Answer

This is because your custom attribute has not been enabled to display in the category page. Go to Admin > Catalog > Attributes > Manage Attributes and select the attribute. Then set the option for "Used in Product Listing" equal to Yes:

enter image description here