How To Show Most Viewed & Best Selling Products In Magento Store

Lately, we have noticed that many Magento store owners started asking us how to show most viewed products or best selling products on their store’s home page or some other places in their store. Unfortunately, there is nothing like these feature pre built in Magento core so you have to tweak and write some lines of code to make it work.

Display Most Viewed Products

Step 1: Create a file app/code/local/Mage/Catalog/Block/Product/Mostviewed.php and add the following lines of code in it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Mage_Catalog_Block_Product_Mostviewed extends Mage_Catalog_Block_Product_Abstract{
    public function __construct(){
        parent::__construct();
        $storeId    = Mage::app()->getStore()->getId();
        $products = Mage::getResourceModel('reports/product_collection')
            ->addOrderedQty()
            ->addAttributeToSelect('*')
            ->addAttributeToSelect(array('name', 'price', 'small_image'))
            ->setStoreId($storeId)
            ->addStoreFilter($storeId)
            ->addViewsCount();
        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
 
        $products->setPageSize(5)->setCurPage(1);
        $this->setProductCollection($products);
    }
}

Step 2: Create a file app/design/frontend/default/YourTheme/template/catalog/product/mostviewed.phtml and add the following lines of code in it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class=" most_viewed">
<div class="mv_title"><?php echo $this->__('These Products Are Popular Right Now!') ?></div>
<?php $_collectionSize = 5;//count($_products->getItems()); echo $_collectionSize; ?>
<ul class="products-grid" id="products-grid-table">
<?php $i=1; foreach ($_products->getItems() as $_product): ?>
    <li id="td_<?php echo $i;?>" <?php if($i%5==0 or $i==$_collectionSize){echo 'class="last"';} ?> >
        <div id="cont_<?php echo $i;?>">        
            <a class="product-image" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>">
                <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
            </a>
            <h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h3>
            <div class="a-center">                        
                <?php if($_product->getRatingSummary()): ?>
                    <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
			    <?php endif; ?>
                <?php echo $this->getPriceHtml($_product, true) ?>
                <?php if($_product->isSaleable()): ?>
                    <button class="button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>
                    <div class="clear"></div>
                <?php else: ?>
                    <p class="availability"><span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span></p>
                    <div class="clear"></div>
                <?php endif; ?>
                <ul class="add-to-links">
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                    <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
                    <?php endif; ?>
                    <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                    <li class="last"><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
    </li>
<?php $i++; endforeach; $kol = $_collectionSize; ?>
</ul>
</div>
<?php endif; ?>

Step 3: Now, we have the code in place which will fetch the most viewed products on call. Still, we need to add a block to show most viewed products in a desired location

1
{{block type="catalog/product_mostviewed" template="catalog/product/mostviewed.phtml"}}

Display Best Selling Products

Step 1: Create a file app/code/local/Mage/Catalog/Block/Product/Bestseller.php and the following lines of code in it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Mage_Catalog_Block_Product_Bestseller extends Mage_Catalog_Block_Product_Abstract{
    public function __construct(){
        parent::__construct();
        $storeId = Mage::app()->getStore()->getId();
        $products = Mage::getResourceModel('reports/product_collection')
            ->addOrderedQty()
            ->addAttributeToSelect('*')
            ->addAttributeToSelect(array('name', 'price', 'small_image'))
            ->setStoreId($storeId)
            ->addStoreFilter($storeId)
            ->setOrder('ordered_qty', 'desc'); // most best sellers on top
        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
 
        $products->setPageSize(3)->setCurPage(1);
        $this->setProductCollection($products);
    }
}

Step 2: Create a file app/design/frontend/default/YourTheme/template/catalog/product/bestseller.phtml file and add the following lines of code in it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class="page-title">
    <h2><?php echo $this->__('Best Seller Products') ?></h2>
</div>
<?php $_collectionSize = count($_products->getItems()) ?>
<table class="products-grid" id="products-grid-table">
<?php $i=1; foreach ($_products->getItems() as $_product): ?>
    <?php if ($i%1!==0): ?>
    <tr>
    <?php endif ?>
        <td id="td_<?php echo $i;?>" <?php if($i%3==0 or $i==$_collectionSize){echo 'class="last"';} ?> >
        <?php contentBlock('top') ?>
        <div id="cont_<?php echo $i;?>">
            <h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h3>
            <a class="product-image" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>">
                <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(122, 109); ?>" width="122" height="109" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
            </a>
            <div class="a-center">                        
                <?php if($_product->getRatingSummary()): ?>
                    <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                <?php endif; ?>
                <?php echo $this->getPriceHtml($_product, true) ?>
                <?php if($_product->isSaleable()): ?>
                    <button class="button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>
                    <div class="clear"></div>
                <?php else: ?>
                    <p class="availability"><span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span></p>
                    <div class="clear"></div>
                <?php endif; ?>
                <ul class="add-to-links">
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                        <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
                    <?php endif; ?>
                    <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                        <li class="last"><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a></li>
                    <?php endif; ?>
                </ul>
                <?php if($_product->getevent_date()) {echo $_product->getevent_date();} ?>
            </div>
        </div>
    </td>
    <?php if ($i%3==0 or $i==$_collectionSize): ?>
   </tr>
    <?php endif ?>
  <?php $i++; endforeach; $kol = $_collectionSize; ?>
</table>
<?php endif; ?>

Step 3: This above files will create a list of best selling products which can be shown anywhere on your Magento store. All you have to do is place the following line of code block in your template to show the best selling products.

1
{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml"}}

Sweet, now we are able to show best selling products and most viewed products anywhere in our Magento store. If you run into any problem implementing the code, please feel free to comment and let me know. Subscribe our RSS To receive latest Magento development updates.

  • http://www.magentoecommercehosting.com/ Magento Hosting

    Dazzling post about
    Magento store! But I’m unable to understand your sharing some coding. Thanks a
    lot :)

  • http://www.beautyindulgence.co.uk ajix

    Hi
    I used your comestic template and i would like to put the best selling on left hand site,  how do i know where in the template to put the code.  Or is the facility already in the template
    Thanks

  • http://beautyindulgence.co.uk ajix

    i also do not have app/code/local/Mage/Catalog/Block/Product in my directory

  • P Svegrup

    Hi there,

    Can’t find a date on your article so not sure how recent it is and hence whether the code posted above is up to date?

    Can I use parameters like column_count=”4″ and num_products=”12″ when I call the blocks? Or would the templates need tayloring to take those variables?

    Cheers

    Peter

  • Meet2teju

    Best Selling Products are not display in my home page…
    plz help me

  • Tushu Dreams

    I have to show best selling product in admin’s menu bar by creating submenu ie. Bess Selling
    {{block type=”catalog/product_bestseller” template=”catalog/product/bestseller.phtml”}}oduct/bestseller.phtml”}}Where I will write this code
     

  • Liam

    Mostviewed code does not work, doesn’t output prices or product names.

  • Heloise

    Hi can you tell me how to add favorite products

  • Sneha

    i cant see any product on fronend in bestseller block.. how to check if there are products or not

  • Navi

    hi , how to add paging toolbar on the page?
     thanks!

  • hoangphuc

    Good! i used Magento 1.7, it has worked.
    But file bestseller.phtml must removed line 12:

  • webmaster.noor

    works great in Magento V-1.7.0.2. Thanks man !!! keep to satisfy your staffs..

  • http://twitter.com/patricksteenks Patrick Steenks

    Great piece of code, but I seem to have some troubles with the displaying of the most viewed products. In Magento 1.7 this code does not seem to work, as it justs takes a random sample of the products in magento.

  • kushagra

    i used same code but getting error

    a:5:{i:0;s:2914:”SELECT SUM(order_items.qty_ordered) AS `ordered_qty`, `order_items`.`name` AS `order_items_name`, `order_items`.`product_id` AS `entity_id`, `e`.`entity_type_id`, `e`.`attribute_set_id`, `e`.`type_id`, `e`.`sku`, `e`.`has_options`, `e`.`required_options`, `e`.`created_at`, `e`.`updated_at`, `e`.`entity_id`, `e`.`attribute_set_id`, `e`.`type_id`, `e`.`activation_information`, `e`.`color`, `e`.`color_value`, `e`.`computer_manufacturers`, `e`.`computer_manufacturers_value`, `e`.`contrast_ratio`, `e`.`contrast_ratio_value`, `e`.`cost`, `e`.`country_orgin`, `e`.`cpu_speed`, `e`.`cpu_speed_value`, `e`.`created_at`, `e`.`custom_design_from`, `e`.`custom_design_to`, `e`.`custom_layout_update`, `e`.`description`, `e`.`dimension`, `e`.`enable_googlecheckout`, `e`.`finish`, `e`.`gallery`, `e`.`gender`, `e`.`gender_value`, `e`.`gift_message_available`, `e`.`harddrive_speed`, `e`.`hardrive`, `e`.`has_options`, `e`.`image`, `e`.`image_label`, `e`.`in_depth`, `e`.`is_recurring`, `e`.`links_exist`, `e`.`links_purchased_separately`, `e`.`links_title`, `e`.`manufacturer`, `e`.`manufacturer_value`, `e`.`max_resolution`, `e`.`media_gallery`, `e`.`megapixels`, `e`.`megapixels_value`, `e`.`memory`, `e`.`meta_description`, `e`.`meta_keyword`, `e`.`meta_title`, `e`.`minimal_price`, `e`.`model`, `e`.`msrp`, `e`.`msrp_display_actual_price_type`, `e`.`msrp_enabled`, `e`.`name`, `e`.`news_from_date`, `e`.`news_to_date`, `e`.`old_id`, `e`.`price`, `e`.`price_type`, `e`.`price_view`, `e`.`processor`, `e`.`ram_size`, `e`.`recurring_profile`, `e`.`required_options`, `e`.`response_time`, `e`.`room`, `e`.`room_value`, `e`.`samples_title`, `e`.`screensize`, `e`.`shape`, `e`.`shipment_type`, `e`.`shirt_size`, `e`.`shirt_size_value`, `e`.`shoe_size`, `e`.`shoe_size_value`, `e`.`shoe_type`, `e`.`shoe_type_value`, `e`.`short_description`, `e`.`sku`, `e`.`sku_type`, `e`.`small_image`, `e`.`small_image_label`, `e`.`special_from_date`, `e`.`special_price`, `e`.`special_to_date`, `e`.`tax_class_id`, `e`.`thumbnail`, `e`.`thumbnail_label`, `e`.`updated_at`, `e`.`url_key`, `e`.`url_path`, `e`.`visibility`, `e`.`weight`, `e`.`weight_type`, `e`.`featured_product`, `e`.`name`, `e`.`price`, `e`.`small_image`, `cat_index`.`position` AS `cat_index_position` FROM `sales_flat_order_item` AS `order_items`
    INNER JOIN `sales_flat_order` AS `order` ON `order`.entity_id = order_items.order_id AND `order`.state ‘canceled’
    LEFT JOIN `catalog_product_entity` AS `e` ON (e.type_id NOT IN (‘grouped’, ‘configurable’, ‘bundle’)) AND e.entity_id = order_items.product_id AND e.entity_type_id = 10
    INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=’1′ AND cat_index.visibility IN(2, 4) AND cat_index.category_id=’3′ WHERE (parent_item_id IS NULL) GROUP BY `order_items`.`product_id` HAVING (SUM(order_items.qty_ordered) > 0) ORDER BY `ordered_qty` desc LIMIT 3

    “;i:1;s:5994:”#0 /var/www/html/mg-projects/macattr/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
    #1 /var/www/html/mg-projects/macattr/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
    #2 /var/www/html/mg-projects/macattr/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
    #3 /var/www/html/mg-projects/macattr/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(‘SELECT SUM(orde…’, Array)
    #4 /var/www/html/mg-projects/macattr/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query(‘SELECT SUM(orde…’, Array)
    #5 /var/www/html/mg-projects/macattr/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query(‘SELECT SUM(orde…’, Array)
    #6 /var/www/html/mg-projects/macattr/lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll(‘SELECT SUM(orde…’, Array)
    #7 /var/www/html/mg-projects/macattr/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1047): Varien_Data_Collection_Db->_fetchAll(‘SELECT SUM(orde…’)
    #8 /var/www/html/mg-projects/macattr/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(871): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
    #9 /var/www/html/mg-projects/macattr/lib/Varien/Data/Collection.php(301): Mage_Eav_Model_Entity_Collection_Abstract->load()
    #10 /var/www/html/mg-projects/macattr/app/design/frontend/base/default/template/catalog/product/bestkush.phtml(5): Varien_Data_Collection->getItems()
    #11 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Template.php(241): include(‘/var/www/html/m…’)
    #12 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView(‘frontend/base/d…’)
    #13 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
    #14 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
    #15 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Model/Email/Template/Filter.php(191): Mage_Core_Block_Abstract->toHtml()
    #16 [internal function]: Mage_Core_Model_Email_Template_Filter->blockDirective(Array)
    #17 /var/www/html/mg-projects/macattr/lib/Varien/Filter/Template.php(134): call_user_func(Array, Array)
    #18 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Model/Email/Template/Filter.php(502): Varien_Filter_Template->filter(‘{{block type=”c…’)
    #19 /var/www/html/mg-projects/macattr/app/code/core/Mage/Cms/Block/Page.php(100): Mage_Core_Model_Email_Template_Filter->filter(‘{{block type=”c…’)
    #20 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Cms_Block_Page->_toHtml()
    #21 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
    #22 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(522): Mage_Core_Block_Abstract->_getChildHtml(‘cms_page’, true)
    #23 /var/www/html/mg-projects/macattr/app/code/core/Mage/Page/Block/Html/Wrapper.php(52): Mage_Core_Block_Abstract->getChildHtml(”, true, true)
    #24 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Page_Block_Html_Wrapper->_toHtml()
    #25 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
    #26 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
    #27 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
    #28 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml(‘content’, true)
    #29 /var/www/html/mg-projects/macattr/app/design/frontend/base/default/template/page/1column.phtml(48): Mage_Core_Block_Abstract->getChildHtml(‘content’)
    #30 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Template.php(241): include(‘/var/www/html/m…’)
    #31 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView(‘frontend/base/d…’)
    #32 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
    #33 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
    #34 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
    #35 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
    #36 /var/www/html/mg-projects/macattr/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
    #37 /var/www/html/mg-projects/macattr/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_PageController), ’10′)
    #38 /var/www/html/mg-projects/macattr/app/code/core/Mage/Cms/controllers/PageController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_PageController), ’10′)
    #39 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_PageController->viewAction()
    #40 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch(‘view’)
    #41 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
    #42 /var/www/html/mg-projects/macattr/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
    #43 /var/www/html/mg-projects/macattr/app/Mage.php(683): Mage_Core_Model_App->run(Array)
    #44 /var/www/html/mg-projects/macattr/index.php(87): Mage::run(”, ‘store’)
    #45 {main}”;s:3:”url”;s:29:”/mg-projects/macattr/bestkush”;s:11:”script_name”;s:30:”/mg-projects/macattr/index.php”;s:4:”skin”;s:7:”default”;}

  • Cheong

    Hi, when i implement the mostviewed products block, i get the following error

    Fatal error: Class ‘Mage_Catalog_Block_Product_Mostviewed’ not found in /opt/lampp/htdocs/magento-1.7/app/code/core/Mage/Core/Model/Layout.php on line 491

    Any idea?

  • Cheong

    I made sure that the php and phtml files are in place, but still no luck

  • ujar

    Is there any way to include “Most viewed” and “Best seller” in the toolbar so that user can filter the products accordingly?

  • Lee

    I’m on 1.7.0.2 and can confirm the bestseller code does work fine.

  • Dan

    Reason people are getting the Magento Exceptions is that this code is not compatible with “Use Flat Catalog Products” option….. If you disable Flat Catalog Products and reindex it runs smoothly… Tested on 1.7.0.2

    Poked around the the .php file provided above and could not see a direct way of adding support for product flat catalog….

  • http://www.unykvis.com/ Ignacio Correia

    1.7.0.2 there is n error in in line 12 of best seller -> contentBlock(‘top’) what does this do?

    It work if I comment…

  • Jim

    Hello

    thank you for sharing the code. it is not a secret that most viewed products can play important role in ecommerce. We spent a lots of time to create different cms blocks with new or most viewed products.

    Now we you http://amasty.com/improved-sorting.html

    maybe it would be helpful for someone to read about such solution.

    Have a nice day,

    Jim

  • puneet

    hi there is proble when i m used galaeve them then best seller products are not showing….

  • puneet

    can i get any solution…?

  • Adnan

    thanx bro its working fine.

  • nkokhi

    HI there, great sharing but how do we add the pages with XML?

  • 0ad

    surround Bestseller.php with ”

  • 0ad

    my code was striped out – surround the code with the php tags and it should work.

  • Aaron Madhavan

    Thanks for the code, I am using 1.7 community. When I look at my most viewed products page it displays a couple products, however it is showing the placeholder instead of the image of the product, and the ones that are showing up have images assigned to them. Also I am not seeing a title of the products, how can I get these to appear?

    Thanks a lot

  • João Gabriel

    Hi, thanks for the code. I did exactly likes in your post, but I made some little changes. I’ve put the code into “page.xml” to register a new reference “product_bestsellers” and after put this getChildHtml(‘product_bestsellers’) ?> on the homepage. However, I’m getting this error message: “Fatal error: Call to a member function getItems() on a non-object in /var/www/deepocean/app/design/frontend/default/deep/template/catalog/product/bestsellers.phtml on line 22″. Have you ever seen this message? What’s wrong?