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

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

系統 2094 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元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。。?/p>

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 大渡口区| 神农架林区| 玉龙| 威宁| 安岳县| 城市| 建昌县| 漳州市| 南康市| 增城市| 西峡县| 农安县| 平谷区| 和田县| 读书| 崇义县| 荆门市| 泉州市| 申扎县| 万安县| 贡山| 巴东县| 海晏县| 仙游县| 乌鲁木齐县| 金门县| 新邵县| 新兴县| 雷山县| 米脂县| 肃南| 慈溪市| 嘉定区| 彭泽县| 于都县| 农安县| 礼泉县| 奉化市| 伊吾县| 龙岩市| 镇沅|