日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

magento創建自定義頁面 (Bestseller實例) Bes

系統 2238 0

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.

?

?

Here is the bestseller.phtml packed in bestseller .zip.

Hope you find this useful.

?

來源: http://inchoo.net/ecommerce/magento/bestseller-products-in-magento/

magento創建自定義頁面 (Bestseller實例) Bestseller products in Magento


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 洛扎县| 汪清县| 吉木萨尔县| 岳西县| 松桃| 台州市| 尼木县| 临夏县| 阿拉善右旗| 湟源县| 普宁市| 太白县| 海阳市| 昭苏县| 江安县| 灵寿县| 若尔盖县| 苏尼特右旗| 黔东| 彭水| 佳木斯市| 肇庆市| 南投县| 长子县| 铜陵市| 平阴县| 内乡县| 衡山县| 平邑县| 潍坊市| 潞城市| 九寨沟县| 宾川县| 长宁县| 泰顺县| 稷山县| 台北县| 汤阴县| 晋中市| 罗甸县| 夏津县|