`
jaychang
  • 浏览: 716461 次
  • 性别: Icon_minigender_1
  • 来自: 嘉兴
社区版块
存档分类
最新评论

How To - Display products on home page

 
阅读更多

There are numerous ways to put products on your home page, and we’ll compile a list of code snippets you can use on your own store here. Some examples are outdated, they don’t work in magento 1.4.1 but solutions are provided at the bottom.

Index

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 are 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>

Note: source taken from BrightEyesDavid’s post

It’s possible to add the ‘Root category’ ID here to show all products (Is Anchor Yes required!)

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"><count>5</count></action>
  4.         <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
  5.         <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
  6.         <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
  7.         <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
  8.         <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
  9.     </block>
  10. </reference>

New products with pagination - Layout Update XML for Magento 1.4.1

By default the Magento New.php and New.phtml block and template do not provide a way for you to display new products with pagination. The pagination and toolbar elements of Magento belong to the Mage_Catalog_Block_Product_List class. It is possible for one to overwrite the New.php file that Magento provides so that it extends the Mage_Catalog_Block_Product_List class and therefore has access to the pagination and toolbar. Found this article which shows how to do this. The steps are a bit long to re-post here, however. This works in Magento 1.4.1 - http://www.dnawebagency.com/displaying-new-products-in-magento-with-pagination

分享到:
评论

相关推荐

    Vue.js 2.x by Example

    With this book, you will learn how to use Vue.js by creating three Single Page web applications. Throughout this book, we will cover the usage of Vue, for building web interfaces, Vuex, an official ...

    Java邮件开发Fundamentals of the JavaMail API

    Instructions on how to download and install the JavaMail API are contained in the course. In addition, you will need a development environment such as the JDK 1.1.6+ or the Java 2 Platform, Standard...

    UE(官方下载)

    How to check your JavaScript source code for common mistakes without actually running the script or opening the web page Character properties at your fingertips Access the properties of a character ...

    微软内部资料-SQL性能优化5

    Without a useful index, Microsoft® SQL Server™ must search every row on every page in table to find the rows to return. With a multitable query, SQL Server must sometimes search a table multiple ...

    XML Processing with Perl, Python, and PHP (2002).pdf

    Think about what you could do if only you knew how to tell Perl to convert your XML- based documents into Word documents for editing, or to HTML for viewing on the Web, or to SQL tables for storage in...

    DevExpress VCL 12.2.6(v2012vol2.6) 源码-例子-帮助-part1

    Q488443 - The 'Control has no parent window' exception is raised when clicking the Back button on a tile detail page if the tile control is located on a form whose FormStyle property is set to ...

    DevExpress VCL 12.2.6(v2012vol2.6) 源码-例子-帮助-part2

    Q488443 - The 'Control has no parent window' exception is raised when clicking the Back button on a tile detail page if the tile control is located on a form whose FormStyle property is set to ...

    PHP Web 2.0 Mashup Projects.pdf

    display them on a Google Map, and retrieve pictures of a selected station from Flickr. Our application needs to communicate with the API servers for which we use AJAX and JSON, which is emerging as ...

    The Art of Assembly Language Programming

    80286 Registers 4.1.5 - 80386/80486 Registers 4.2 - 80x86 Physical Memory Organization 4.3 - Segments on the 80x86 4.4 - Normalized Addresses on the 80x86 4.5 - Segment Registers on ...

    i-vector的工具箱

    This function implements global cepstral mean and variance normalization (CMVN) on input feature matrix fea to remove the linear channel effects. The code assumes that there is one observation per ...

    计算机毕业设计-基于ASP-sql-c++娱乐新闻网站.doc

    businesses can display products through the web site , publishing the latest developments, exchange and communication with users, with partners to establish contacts and conducting e-commerce....

    雅虎TAB效果代码 Javascript实现

    &lt;p&gt;Maybe a link to your emails or a form asking to login to retrieve your emails, or even a link to a &lt;a href="http://www.cssplay.co.uk/w3c/contact.html"&gt;Contact Page&lt;/a&gt;. &lt;!--[if lte IE 6]&gt;&lt;/td&gt;&lt;/tr...

Global site tag (gtag.js) - Google Analytics