This could be the problem:
<img src="../images/sale-icon.png" width="101" height="58" class="onsaleicon" />
When you are not on homepage the relative path to the image is wrong.
Use this instead:
<img src="<?php echo $this->getSkinUrl('images/sale-icon.png')?>" width="101" height="58" class="onsaleicon" />
and place your image in skin/frontend/{interface}/{theme}/images/
.
Small tip:
Don't use this:
$specialprice = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialPrice();
// Get the Special Price FROM date
$specialPriceFromDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialFromDate();
// Get the Special Price TO date
$specialPriceToDate = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialToDate();
You are loading the product 3 times and you don't need to do that. You can load it only once if neccesary:
$mainProduct = Mage::getModel('catalog/product')->load($_product->getId());
$specialprice = $mainProduct->getSpecialPrice();
// Get the Special Price FROM date
$specialPriceFromDate = $mainProduct->getSpecialFromDate();
// Get the Special Price TO date
$specialPriceToDate = $mainProduct->getSpecialToDate();
but you can go without loading it, by editing the attributes 'special_price', 'special_from_date' and
special_to_date` and setting
used in product listingto
yes`.
bigger tip:
You can check if the product has a discount without checking the special price and the dates. This works even if you have a discount from a catalog rule:
if ($_product->getPrice() > $_product->getFinalPrice())
Best Answer
You are supposed to define explicitly a pagination toolbar in the layout XML and "bind" it to the product listing template. Unfortunately, calling the block directly from the template (CMS page content in your case) has one huge disadvantage: there's no reference to such a block for the layout updates.
What I would do to achieve your goals is to remove following statement:
from the Content textaraea and move it to the layout updates instead.
Go to the Design tab in your CMS page and add following statement to the Layout Update XML textarea:
Just keep in mind that Content is a required field, so you cannot leave it empty. You can put in there
<p> </p>
or<div></div>
or<!-- -->
or whatever else giving no output on the frontend.EDIT: Alternatively, in the Layout Update XML textarea you can define the toolbar only:
and append it to the product listing template directly in the Content textarea, by adding toolbar_block_name attribute:
Actually, the "alternative" method should be the basic one, but I wasn't sure of it and just checked it on some working Magento installation.