Bestselling Products on Home Page

To add a block into Home Page you need to  login into the Magento : CMS > Manage Pages > Home. Then add the following to the Content area:

{{block type=”catalog/product” show_total=”12″ template=”catalog/product/bestseller.phtml”}}

Now put the following code into catalog/product/bestseller.phtml –

$visibility = array(

 Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,

  Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG

  );

 $_productCollection = Mage::getResourceModel(‘reports/product_collection’)

                      ->addAttributeToSelect(‘*’)

                      ->addOrderedQty()

                      ->addAttributeToFilter(‘visibility’, $visibility)

                      ->setOrder(‘ordered_qty’, ‘desc’);

 $totalPerPage = ($this->show_total) ? $this->show_total : 6 ;

Here you have the Best selling Product Collection. Now feel free to manage your Bestseller page with your own Style.

Advertisements

One thought on “Bestselling Products on Home Page

  1. Pingback: Add Custom “Sort By” Drop Down menu options In Magento | Magento For Fresher

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s