I want to display a product label if a cart rule has been applied to a product but the label is being displayed for all products even those who don't qualify for the cart rules.
Here is the code I am testing:
$rules = Mage::getModel('salesrule/rule')->getCollection();?>
//echo count($rules);
<?php foreach ($rules as $rule) :?>
<?php $hasPromo=$rule->getConditions()->validate($_product) ;
if ($hasPromo)
{
$Tag = $rule->getDescription();
?>
<div class="libelle-promo"><?php echo $Tag; ?></div>
<?php
}
else { ?>
<div class="libelle-promo" style="display: none;"></div>
<?php }
?>
<?php endforeach;?>