0

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?

5

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

|improve this answer|||||
  • Perfect! That did the trick. Thanks for the help. – frshjb373 Feb 13 '15 at 19:20
  • Awesome. Please click the green accept icon under the vote up/down buttons! ☑️ – philwinkle Feb 13 '15 at 19:28

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.