/*Get overall Bestselling products*/ 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; } /*Get Bestselling products for current category*/ 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) ->addCategoryFilter(Mage::registry('current_category')) ->setOrder('ordered_qty', 'desc') ->setPageSize($productCount); Mage::getSingleton('catalog/product_status') ->addVisibleFilterToCollection($products); Mage::getSingleton('catalog/product_visibility') ->addVisibleInCatalogFilterToCollection($products); return $products; } /*Get Bestselling products for last 30 days*/ public function getBestsellingProducts() { // number of products to display $productCount = 5; // store ID $storeId = Mage::app()->getStore()->getId(); // get today and last 30 days time $today = time(); $last = $today - (60*60*24*30); $from = date("Y-m-d", $last); $to = date("Y-m-d", $today); // get most viewed products for current category $products = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') ->addOrderedQty($from, $to) ->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; }
相关推荐
"Bestselling"扩展是Magento系统中用于展示最畅销产品的功能模块。这个功能能够帮助商家突出那些销售业绩优秀的产品,从而引导顾客关注并购买,提升销售额。 在Magento中,`Bestseller.php` 文件很可能是一个模型...
The books that paved my career as a behavioral designer and bestselling author _Nir Eyal in UX Collective.txt
In the updated edition of this critically acclaimed and bestselling book Microsoft project veteran Scott Berkun offers a collection of essays on field tested philosophies and strategies for defining ...
Rich Finelli’s modern CSS training course, based on his bestselling Mastering CSS video, now available in a book. Master CSS from best practices to practical CSS coding. Rich Finelli trains you in ...
Second edition of the best selling Python book in the world. A fast-paced, no-nonsense guide to programming in Python. This book teaches beginners the basics of programming in Python with a focus on ...
Excel at Excel with the help of this bestselling spreadsheet guide John Walkenbach's name is synonymous with excellence in computer books that decipher the complexities of Microsoft Excel. Known as ...
Second edition of the best selling Python book in the world. A fast-paced, no-nonsense guide to programming in Python. This book teaches beginners the basics of programming in Python with a focus on ...
This convenient reference is drawn from the very best of bestselling author Alan Simpson¡¯s Alan Simpson¡¯s Windows Vista Bible. You¡¯ll discover how to master the basics of PCs and operating ...
最佳亚马逊图书2009年至2019年亚马逊最畅销书的数据。 来自kaggle.com的数据集: ://www.kaggle.com/sootersaalu/amazon-top-50-bestselling-books-2009-2019 专注于创建可视化
This update to the bestselling first edition dives in to cover the exciting new features of the latest release of the Android mobile platform.Providing in-depth coverage of how to build mobile ...
Everything you need to know to develop your own bestselling iPhone and iPad apps Utilizing Swift playgrounds Best practices for optimizing your code and delivering great user experiences< What data ...
很多软件工程的书都从学术角度介绍软件工程。本书以手册形式提供软件工程的内容,便于直接参考所需... The successor to the bestselling Software Engineering Productivity Handbook, this book fulfills that need.
In this book, bestselling Android programming authors Lauren Darcey and Shane Conder teach you every skill and technique you need to write production-quality apps for Amazon Kindle Fire, the world’s ...
Bestselling author and Windows expert William Stanek doesn’t just show you the steps you need to follow, he also tells you how features work, why they work, and how you can customize them to meet ...
In this new edition of the best selling title, the author explains the important and relevant XML technologies and their capabilities clearly and succinctly with plenty of real-life projects and ...