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:
-
{{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:
-
{{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:
-
{{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:
-
<reference name="content">
-
<block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
-
<action method="setCategoryId"><category_id>[category id here]</category_id></action>
-
</block>
-
</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
-
<reference name="content">
-
<block type="catalog/product_new" template="catalog/product/new.phtml">
-
<action method="setProductsCount"><count>5</count></action>
-
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
-
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
-
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
-
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
-
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
-
</block>
-
</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
相关推荐
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...
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 ...
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 ...
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...
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 ...
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 ...
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 ...
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 ...
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 ...
<p>Maybe a link to your emails or a form asking to login to retrieve your emails, or even a link to a <a href="http://www.cssplay.co.uk/w3c/contact.html">Contact Page</a>. <!--[if lte IE 6]></td></tr...