Documentació extreta de Add Featured Products to Home Page
{{block type="catalog/product_list" category_id="8" template="catalog/product/list.phtml"}}
Editem category_id=“8” pel id de la categoria
Si volem crear una plantilla nova:
{{block type="catalog/product_list" category_id="19" template="catalog/product/homelist.phtml"}}
Creem el nostre nou fitxer homelist.phtml
app/design/frontend/default/yourtheme/template/catalog/product/homelist.phtml
<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php if(!$_productCollection->count()): ?>
<div class="note-msg">
<?php echo $this->__('There are no products matching the selection.') ?>
</div>
<?php else: ?>
<div class="box best-selling">
<?php $_collectionSize = $_productCollection->count() ?>
<table border="0" cellspacing="0">
<tbody>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php if($i++%2==0): ?>
<tr>
<?php endif; ?>
<td>
<a href="<?php echo $_product->getProductUrl() ?>" >
<img class="product-img" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(95, 95); ?>" width="95" height="95" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
</a>
<div class="product-description">
<p><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php echo nl2br($_product->getShortDescription()) ?>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><small><?php echo $this->__('Learn More') ?></small></a>
</td>
<?php if($i%2==0 || $i==$_collectionSize): ?>
</tr>
<?php endif; ?>
<?php endforeach ?>
<script type="text/javascript">decorateGeneric($$('tr'), ['last', 'odd', 'even']);</script>
</tbody>
</table>
</div>
<?php endif; //$_productCollection->count() ?>