我有一個名爲「Top Products」的類別。我希望在我的主頁上的一個面板中顯示。在magento中做這件事的最好方法是什麼?如何編寫一個顯示magento類別的自定義面板
**編輯**
感謝sdek,我現在有以下。在主頁/設計。
<block type="catalog/product_list" category_id="13" template="catalog/product/featured.phtml"/>
它正在顯示產品。不過,我有以下問題。 - 它不顯示來自category_id 13的產品,看起來像這個值沒有通過 - 它只顯示2個產品。我希望顯示所有。
featured.phtml
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<h2>Featured Products </h2>
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="product-grid">
<?php endif ?>
<li class="<?php if(($i-1)%$_columnCount==0): ?> first<?php else: ?> last<?php endif; ?>">
<a class="product-image" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" >
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(85); ?>" class="product-img" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" style="padding-bottom:20px; margin-bottom:20px;" />
</a>
<p><strong><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></strong>
<?php echo $_product->getShortDescription(); ?></p>
<?php echo $this->getPriceHtml($_product, true) ?>
<a href="<?php echo $_product->getProductUrl() ?>" class="more">More details</a>
</li>
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
</ul>
<?php endif ?>
<?php endforeach ?>
<?php endif; ?
謝謝,真的很感謝回覆。對於magento很新穎。開始瞭解這一切如何融合在一起。你介意快速瀏覽一下上面的問題嗎?似乎無法得到正確的類別 – frosty 2010-12-05 11:25:27