Magento首页显示产品

 

 
经常用的比较琐碎,上官网发现一个稍微全一点的
不过没有针对 具体使用过程中遇到的情况进行修正  
这边只做一个备忘吧   (细节问题 按个别情况进行修改即可)

New products

Go to “CMS - Manage Pages” and select “Home Page” from the list of pages.

Use this code snippet to show products labeled as “new” on your front page:

  1. {{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}

(Note that you must have some new products in your catalogue for anything to show when you do this. In this context new doesn’t mean that you’ve recently added them; only products explicitly marked as new using ‘Set Product as New from Date’ and ‘Set Product as New to Date’ options in the ‘General’ product information page in the admin tool will be shown.)

All Products

Go to “CMS - Manage Pages” and select “Home Page” from the list of pages.

Use this code snippet to show all products in your catalog on your front page:

  1. {{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml"}}

All Products from one Category

Go to “CMS - Manage Pages” and select “Home Page” from the list of pages.

Use this code snippet to show one category on your front page:

  1. {{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="4" template="catalog/product/list.phtml"}}

The category ID can be found when you go to “manage category” and then select the category you want. The ID is written in the header.

Examples is outdated, dosent work in magento 1.4.1

Layout Update XML for magento 1.4

Because in 1.4 version Layout update is different than in 1.3 version, you can use this example:

  1. <reference name="content">
  2.     <block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
  3.         <action method="setCategoryId"><category_id>[category id here]</category_id></action>
  4.     </block>
  5. </reference>

New products - Layout Update XML for magento 1.4

To display new product / latest product, you can use this following XML code in layout xml file or layout display in backend. You can use also the widgets to display the products. The code below has been inspired by the widget.

diglin

  1. <reference name="content">
  2.     <block type="catalog/product_new" template="catalog/product/new.phtml">
  3.         <action method="setProductsCount">5</action>
  4.         <actionmethod="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
  5.         <actionmethod="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
  6.         <actionmethod="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
  7.         <actionmethod="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
  8.         <actionmethod="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
  9.     </block>
  10. </reference>

Magento首页显示产品的更多相关文章

  1. magento如何在首页显示产品

    1.首先现在magento后台创建一个新的分类,记下这个分类的 ID 号码.使用这个新建的分类来管理你的首页产品,这个分类设置为前台不可见.这样就不会显示在你的分类菜单中了,但使用代码调用的时候却会显 ...

  2. Magento给新产品页面添加分页

    本文介绍如何让magento创建一个带分页功能的新到产品页面,方便我们在首页或者其它CMS Page调用和展示新到产品. 在Magento我们经常有的做法是建立一个可以调用新产品的block,然后通过 ...

  3. 搬家后Magento前台只有产品的缩略图不显示

    第一种可能:缓存不足 http://blog.csdn.net/ddjohn/article/details/6648199 最近发现一个怪异的现象,Magento前台只有产品的缩略图不显示.我检查了 ...

  4. Magento后台订单显示产品图片的修改方法

    Magento后台订单原来是没有显示产品图片,客服业务还得到网站前台查找这个产品的图片提供给发货部,这样是很不方便的.为提高工作效率,应客服业务要求,现对Magento后台订单进行修改,使订单页面就显 ...

  5. 如何更改/删除magento首页产品/广告图片等模块信息

    如何更改/删除magento首页产品/广告图片等模块信息,如果只是修改一些简单的地方,例如已经存在 的左右栏目里面的图片内容等,是很简单的,直接在后台就可以修改的,具体如下: 如何删除magento首 ...

  6. SSH电力项目九--运行监控首页显示

    需求:在首页显示出设备运行情况,并去掉<br>换行符,每隔十分钟刷新一次页面. ElecMenuAction.java 首先注入运行监控service public class ElecM ...

  7. 在SAP UI中使用纯JavaScript显示产品主数据的3D模型视图

    在Jerry写这篇文章时,通过Google才知道,SAP其实是有自己的3D模型视图显示解决方案的. 故事要从Right Hemisphere说起,这是一家专业的企业级2D/3D模型浏览及转换的软件供应 ...

  8. HTML基础——网站首页显示页面

    1.表格标签: border设置边框,align设置位置(居中等),bgcolor设置背景颜色,cellspacing设置边框之间的空隙,cellpadding设置边框与里面内容的间距. table表 ...

  9. zencart分类页每页显示产品数量自定义选择的方法

    zencart默认分类页每页显示产品数量是固定的,如何让顾客可以选择每页显示的产品的数量呢?效果图 方式一:全部展示 方式二:下拉菜单 修改方法 1.导入sql INSERT INTO configu ...

随机推荐

  1. robotium和appium的一些区别

    Appium是基于UIAutomator框架实现的.Appium测试进程与目标应用进程是分开的,所以Appium不能直接访问目标应用的各种element属性进行copy&paste,而只能模拟 ...

  2. javascript动画效果之匀速运动

    html和css写在一起方便看,div通过定位设置为-200隐藏,span也是通过定位定在div靠左的中间 <!DOCTYPE html> <html> <head> ...

  3. Linux RSS/RPS/RFS/XPS对比

    RSS适合于多队列网卡,把不同的流分散的不同的网卡多列中,至于网卡队列由哪个cpu处理还需要绑定网卡队列中断与cpu RPS:适合于单队列网卡或者虚拟网卡,把该网卡上的数据流让多个cpu处理 RFS: ...

  4. HeapSpray初窥(2014.12)

    注:环境是xp+ie8 1.HeapSpray简介 Windows的堆因为动态分配和释放的特点,其看起来是不连续(没有规律的),但是仍可以找到一定的规律:大量的连续分配会更倾向使用连续的地址,减少了碎 ...

  5. iOS 打包上传AppStore相关(1)-相关证书配置

    最近一个老项目需要更新迭代,一个新的项目需要上线.有一些自己出现的BUG,也有一些没搞懂到处翻资料的问题.在此想做一个总结,写一下总体步骤,尽可能的详细一些,以及自己的一些理解.有很多步骤因为我们查阅 ...

  6. 恢复SQLSERVER被误删除的数据(转)

    恢复SQLSERVER被误删除的数据 曾经想实现Log Explorer for SQL Server的功能,利用ldf里面的日志来还原误删除的数据 这里有一篇文章做到了,不过似乎不是所有的数据类型都 ...

  7. JavaScript(4)——闭包与this对象以及window对象

    闭包与this对象以及window对象 这次写的是这三个内容.其实在写之前,会觉得这三个内容很多,但是写了之后会发现,内容确实很多,但是可以写出来的也并不是很多.可能是我总结能力太差.但是这些内容我觉 ...

  8. Git单独checkout子目录

    http://schacon.github.io/git/git-read-tree.html#_sparse_checkout Existing Repository If you already ...

  9. jQuery第一章

    一.jQuery的优势 1.轻量级:压缩之后大小只有30KB左右. 2.强大的选择器:jQuery允许CSS1到CSS3几乎所有的选择器以及自身独创的选择器. 3.出色的DOM操作的封装:jQuery ...

  10. Ansible9:条件语句【转】

    在有的时候play的结果依赖于变量.fact或者是前一个任务的执行结果,从而需要使用到条件语句. 一.when    有的时候在特定的主机需要跳过特定的步骤,例如在安装包的时候,需要指定主机的操作系统 ...