J'ai une catégorie appelée "Top Products". Je souhaite l'afficher dans un panneau sur ma page d'accueil. Quelle est la meilleure façon de le faire dans magento.comment écrire un panneau personnalisé affichant les catégories dans magento
** modifier **
Merci sdek, j'ai maintenant ce qui suit. En page d'accueil/Design.
<block type="catalog/product_list" category_id="13" template="catalog/product/featured.phtml"/>
Et c'est l'affichage des produits. Cependant, j'ai les problèmes suivants. - il n'affiche pas les produits de category_id 13, Il semble que cette valeur ne soit pas passée par - c'est seulement afficher 2 produits. Je souhaite afficher tout.
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; ?
merci, vraiment apprécier la réponse. Très nouveau à Magento. commencer à voir comment tout cela s'accorde. Cela vous dérange-t-il de jeter un coup d'œil à la question ci-dessus? Impossible de trouver la bonne catégorie – frosty