Product specials on home page

This tutorial explains briefly how to display one product on sale on the right column of thehome page, but that could be any page in fact.The code below is inspired from the front page featured product tutorial.

  • Step 1 : create the product special block  class/ Note that the getSpecialProducts function is inspired from the sales catalog list extension
    create the file app\code\local\PoleOuest\Catalog\Block\Product\Special.php
  • Step 2 : add new block to your etc/config.xml in global/blocks/catalog
    <rewrite>
    <product_special>PoleOuest_Catalog_Block_Product_Special</product_special>
    </rewrite>
  • Step 3 : create your template catalog/product/PoleOuestSpecial.phtml with the loop inspired from the catalog/product/list.phtml
  • Step 4 : declare your block in your layout/catalog.xml in the right.permanent.callout block
    <block type=”catalog/product_special” name=”product_special” as=”product_special” template=”catalog/product/PoleOuestSpecial.phtml” />
  • Step 5 : call your child HTML where you want it in \template\callouts\right_col.phtml :
    <?php echo $this->getChildHtml(‘product_special’) ?>

and let us know how it went for you

One comment on “Product specials on home page
  1. Hey buddy, thanks for your article. It helped me a lot ;) also it will be better if you do not use these ugly quotes when publish your code :)
    also you can add these
    Mage::getSingleton(‘catalog/product_status’)->addSaleableFilterToCollection($specials); Mage::getSingleton(‘cataloginventory/stock’)->addInStockFilterToCollection($specials);

    for showing only available and salable products.
    And the last:
    ->addAttributeToSelect($productAttributes, ‘inner’) – this does not work for me(I have empty results), only ‘left’ join works well.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

pubMagentoEditLink