I'm trying to display a "Free Gift" label on the product picture for any product that has the custom options label "Free Gift".
The code I have below works on the actual product page but if I try it on the product list page (list.phmtl) the "Free Gift" label isn't showing up.
I've been told to load my collection but I'm not sure how to do that, won't that also slow my site down if I'm loading my entire collection each time somebody goes on a product list page?
Maybe there's a different solution to my issue?
<?php
$theoptions = $_product->getOptions();
foreach($theoptions as $opkey=> $opval)
if(( $_product->getData('has_options')) && ($_product->getTypeID() == 'simple') && ($opval->getTitle() == 'Free Gift')): ?>
<div class="free_gift_text"><?php echo "Free Gift" ?></div>;
<?php endif; ?>
foreach
loops. Make sure you put your label inside of both loops