Magento - sale label on sale products using catalog price rules

1.7k views Asked by At

I have magento 1.6.2.

In my store sale labels are being shown on products which have a special price (set per product)

Here for the following code is being used:

  function getProductLabel($_product, $list_mode)
    {
        if (!$list_mode) return;
        $output = '';
        if (Mage::getStoreConfig('product_labels/show_sale_label')) {

            $now = date("Y-m-d");
            $specialFrom = substr($_product->getData('special_from_date'), 0, 10);
            $specialTo = substr($_product->getData('special_to_date'), 0, 10);

            $special = false;

            if (!empty($specialFrom) && !empty($specialTo)) {
                if ($now >= $specialFrom && $now <= $specialTo) $special = true;

            } elseif (!empty($specialFrom) && empty($specialTo)) {
                if ($now >= $specialFrom) $special = true;

            } elseif (empty($specialFrom) && !empty($specialTo)) {
                if ($now <= $specialTo) $special = true;
            }
            if ($special) $output .= '<div class="label_sale_' . Mage::getStoreConfig('product_labels/sale_label_position') . '"></div>';

        }

But this doens't work with products which have a sale price set by the catalog price rules.

How can i change this code so the sale label will also be shown when a special price is being generated by the catalog rules?

Thanks in advance.

0

There are 0 answers