Display Sale icon on special price products in magento. Only at homepage it is showing not in all pages

Display Sale icon on special price products in magento. Only at homepage it is showing not in all pages

July 25, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Display Sale icon on special price products in magento. Only at homepage it is showing not in all pages

Display Sale Icon on Special Price Products Across All Magento Pages

As an experienced e-commerce developer, I’ve encountered this issue many times – displaying a sale icon consistently across all product pages in Magento can be challenging, but it’s certainly achievable with the right approach.

Current Approach and Limitations

The provided code is almost correct. You’re checking for special pricing conditions and attempting to display the sale icon if the criteria are met. However, there are two primary issues causing the inconsistency:

  1. The code is only applied on the homepage due to its placement within the app/design/frontend/default/template/catalog/product/list.html file. This file is specifically used for the catalog product list view.

  2. Magento uses different templates for different page types (category pages, search results, etc.). By editing a single file, you’re only affecting one specific template type.

A More Comprehensive Solution

To ensure the sale icon displays consistently across all pages, we need to use an event observer and apply our logic there. This way, our code will be triggered for every product listing regardless of the page type.

Here’s a step-by-step guide:

  1. Create a new module (e.g., Mage_Laravel_SaleIcon).

  2. In app/code/local/Mage/Laravel/SaleIcon/etc/config.xml, add an event observer configuration:

<config>
    <global>
        <events>
            <catalog_block_product_listCollection_afterLoad>
                <observers>
                    <laravel_saleicon_observer>
                        <class>Laravel_SaleIcon_Model_Observer</class>
                        <method>addSaleIconToProductList</method>
                    </laravel_saleicon_observer>
                </observers>
            </catalog_block_product_listCollection_afterLoad>
        </events>
    </global>
</config>
  1. Create the observer class app/code/local/Mage/Laravel/SaleIcon/Model/Observer.php:
class Laravel_SaleIcon_Model_Observer {
    public function addSaleIconToProductList($observer) {
        $products = $observer->getCollection();
        foreach ($products as $product) {
            // Perform your special pricing and date checks here, same logic as before
            if (your_special_price_checks_here()) {
                $product->setHasSpecialPrice(true);
            }
        }
    }
}
  1. Override the product view template app/design/frontend/default/template/catalog/product/list.phtml:
<!-- Assuming you have already checked for special pricing -->
<?php if ($this->hasSpecialPrice()): ?>
    <img src="<?php echo $this->getSkinUrl('images/sale-icon.png') ?>" width="101" height="58" class="onsaleicon" />
<?php endif; ?>

Conclusion

By using an event observer to apply your logic at the collection level, you ensure that the sale icon is checked and added for every product listing regardless of the page type.

Remember, consistency is key in e-commerce. Users expect a uniform shopping experience across all pages of your site, including the display of special pricing information.

For more advanced customizations like this, I recommend checking out our comprehensive guide on Magento extension development at LaravelCompany. It provides in-depth coverage of best practices and common challenges faced by developers working with Magento’s architecture.

Don’t hesitate to explore the resources available on our platform – we’re here to help you master the art of e-commerce development!

Catalog Extensions Themes Configuration

Our network