holy shit

寺夺喜从天降

输出指定分类

phtml文件:

<h1>custom category</h1>
<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>

<?php $_iterator = 0; ?>

<?php foreach ($_productCollection as $_product): ?>

<?php //image ?>
<a 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, 'small_image')->resize(150); ?>" width="150″ height="150″ alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
<?php // title description ?>
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
<p>title:</p>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a>
<p>price:</p>
<?php echo $this->getPriceHtml($_product, true) ?>

<?php endforeach; ?>
<?php endif; ?>

引用:

<reference name="content">
    <block type="catalog/product_list" name="custom.category" template="custom/custom_category.phtml">
        <action method="setCategoryId"><category_id>3</category_id></action>
    </block>
</reference>

{{block type="catalog/product_list" category_id="28" products_count="9" template="custom/custom_category.phtml"}}

posted @ 2011-06-04 12:06  潜水鱼  阅读(213)  评论(0编辑  收藏  举报

holy shit on foot