Magento Over all best selling Product on Home page
Add new function in files as per the version
- app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers.php
- app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers/Collection.php
public function getBestsellingProducts()
{
// number of products to display
$productCount = 5;
// store ID
$storeId = Mage::app()->getStore()->getId();
// get most viewed products for current category
$products = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->addOrderedQty()
->setStoreId($storeId)
->addStoreFilter($storeId)
->setOrder('ordered_qty', 'desc')
->setPageSize($productCount);
Mage::getSingleton('catalog/product_status')
->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility')
->addVisibleInCatalogFilterToCollection($products);
return $products;
}
and call that function you will get all overall Best Selling Product
Hope this may help you
- app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers.php
- app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers/Collection.php
public function getBestsellingProducts()
{
// number of products to display
$productCount = 5;
// store ID
$storeId = Mage::app()->getStore()->getId();
// get most viewed products for current category
$products = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->addOrderedQty()
->setStoreId($storeId)
->addStoreFilter($storeId)
->setOrder('ordered_qty', 'desc')
->setPageSize($productCount);
Mage::getSingleton('catalog/product_status')
->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility')
->addVisibleInCatalogFilterToCollection($products);
return $products;
}
and call that function you will get all overall Best Selling Product
Hope this may help you
Thank you for the post.
ReplyDeleteI'm convinced that bestsellers can boost eCommerce profit and help web shop owner get much money.
that's why one day i decided to try magento extension. And i didn't disappointedю It works perfect and save me lots of time.
I created lots of new products blocks, bestsellers and most viewed.
If anybody is interested you can read about extension which i use http://amasty.com/improved-sorting.html
I hope this information will be useful for someone.
Have a nice day,
Jim
Thanks JIM
ReplyDelete