ZC 1.5.7
Bootstrap with OPC

I have been looking into having and "sale" image overlay on product image when poduct is part of a sale ( ie SaleMaker).

I came across this plugin https://www.zen-cart.com/downloads.php?do=file&id=1327 but it is farely old contribution and only refer to category/subcategory image.

How can i adapt the code so it works for product image?

The code for category image is :

Code:
<!-- JF 15.10.2012 if category contains sale items then overlay image -->

<?php
$testcat = strpos(($_GET['cPath']), '_');
if ($testcat === false) {
$cateID = $_GET['cPath']; // Set the master cat id
} else {
$cateID = substr($cPath, ($testcat +1), 4); 
}
$sql =  
"select * from (". TABLE_SPECIALS ."  left join ". TABLE_PRODUCTS ." on ". TABLE_SPECIALS.".products_id = ". TABLE_PRODUCTS .".products_id) where ". TABLE_PRODUCTS .".master_categories_id = '". $cateID ."' and " . TABLE_SPECIALS . ".status = 1";

$onsale = $db->Execute ($sql);

if ($onsale->RecordCount() >= 1) {
        ?> 
<span class="sale"><img src="/images/onsale.png" alt="Sale Item"></span>
<?php      
}
?>

<?php
$sql2 = "select * from ". TABLE_SALEMAKER_SALES ."  where ". TABLE_SALEMAKER_SALES.".sale_categories_selected = '". $cateID ."' and " . TABLE_SALEMAKER_SALES . ".sale_status = 1";

$onsale2 = $db->Execute ($sql2);

if (($onsale2->RecordCount() >= 1) && ($onsale->RecordCount() == 0 )) {
        ?> 
<span class="sale"><img src="/images/onsale.png" alt="Sale Item"></span>
<?php      
}
?>


<!-- EOF JF 15.10.2012 -->
I am assuming i would have to edit product_listing and/or product_info file somehow.

Thank you for any suggestions or help with this.