Bestseller products in Magento
来源:互联网 发布:php 调用js 编辑:程序博客网 时间:2024/04/30 05:22
Bestseller or best selling product is one of the features people tend to ask for when it comes to Magento?.
There are multiple ways to implement this feature.
In this example, I’m not using controller or model directories at all; I’m going to show you how to implement this feature using only one file: the View.
Basically, what you need to do is to create the directory inside your template directory and place the bestseller.phtml file in it. In my example, I’m using the custom-created directory /inchoo. All of the screenshots provided here are based on that directory structure.
Adding this feature to your store is a matter of two simple steps:
- copy bestseller-phtml file to your directory
- display the block on home page
To add a block to a home page, you simply log into the Magento, CMS > Manage Pages > Home. Then add the following to the content area:
{{block type=”core/template” template=”inchoo/bestseller.phtml”}}
Notice the type attribute. I used core/template which means you can place this code anywhere in your site and it will work. Code does not inherit any collection objects from controllers since it has none. All that is necessary for the bestseller.phtml to work is defined in that single file.
One more thing: If you study the code in bestseller.phtml file you will see, at the very top of the file, the part that says: $this->show_total.
If I were to write
{{block type=”core/template” show_total=”12″ template=”inchoo/bestseller.phtml”}}
in my home page, then $this would be assigned property show_total with a value of 12.
Therefore, the provided bestseller.phtml file provides the option of setting the number of products you wish to see listed.
an this, is the final view……
- Bestseller products in Magento
- Display sub-category products in root category in Magento
- Do not show out of stock products in Magento
- [Magento] Add downloadable products
- Magento: How to list all the products in a single category in a sidebar block
- Display your products in random order in magento?(随机排列产品)
- magento -- 现有畅销排行(Bestseller)插件中存在的问题
- How to show related products in product view page with magento?
- magento -- 推荐插件 -- Featured Products
- Magento add most popular products
- How to Import Products into Magento
- How to import products into Magento?
- Magento 修改首页 New Products 列数
- Magento排序功能(Bestseller,Mostviewed,Recommend) 除了1.3支持的属性排序(Sort By Attribute)
- magento导入导出Custom Options, Tier Prices and Grouped Products
- Magento -- 让Magento系统目录只显示有库存的产品(Instock Products Only)
- addAttributeToFilter Conditionals In Magento
- Using Collections in Magento
- Magento后台添加产品首页显示不了的解决方法
- Servlet多线程机制
- magneto 1.4中产品不在前台显示的四大因素
- Magento中如何调用SQL语句
- 双硬盘装Linux+WinXP的曲折经过
- Bestseller products in Magento
- .NET OracleLob 读写操作
- SQLServer 2005中Sa用户可以登录进去,Windows管理员却无法登陆进去
- 高端人才必看,生意人必读!
- 自动化测试 - RFT系列教程9:最复杂的控件:TABLE(二) 表格的行数是不确定的
- ifconfig 源码分析
- 块设备
- VC如何获取QQ好友发来的信息
- 中嵌协会举办第一期“嵌入式与物联网”主题论坛