Featured Products from a category on frontpage

Last modified by AnthonyBliss on Fri, June 25, 2010 11:11
Source|Old Revisions  

This is an old revision of the document!


Here is a simple way to display products on the home page. The products can be easily updated and there is no database burden that could slow down the homepage. A new category is created to hold the featured products, products get cross-posted to it and a copy of the existing list viewer template pulls through the files.

  • copy template file for new featured products block

/app/design/frontend/default/default/template/catalog/product/list.phtml to /app/design/frontend/default/default/template/catalog/product/featured.phtml

  • edit the new featured.phtml file to remove the code:

<?php echo $this→getToolbarHtml() ?> (2 places)

  • Create a new category or select an existing category that you want to highlight as featured products
  • Tidy the product selection in the ‘featured’ product category. Note that you can post your products in two categories, the new ‘featured’ category and a main category in the product catalog tree.
  • In admin go to catalog → URL rewrite management. Note down the ID of your featured category.
  • In admin go to cms → manage pages and edit the home page to include this code where you want to display the featured products:
  1. {{block type="catalog/product_list" category_id="2" template="catalog/product/featured.phtml"}}

category_id : this is the featured category id as discovered from looking at the ID’s in the catalog → URL rewrite.

template : this is the template phtml file created earlier.

Note that the featured products category can sit outside of the root catalog structure and does not have to be accessible via the navigation. Note that you can also choose the grid or the list template to copy for your featured.phtml, the header text for the block can either go in the template file or the homepage CMS text, depending on how you want to do it.

Note #2 Be aware, breadcrumbs will return a 404 if your featured products category is set to not be shown on the menu. You might have sucess in using the Magento’s rewrite system to counteract this.


auday




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs