开发者

Can I add php code that will change list.phtml to display all products for the category?

开发者 https://www.devze.com 2023-02-20 23:13 出处:网络
Can I add php code that will开发者_运维知识库 change list.phtml to display all products for the category?I\'m recommed create new extension to display all product;I agree with Mivec, you have to add y

Can I add php code that will开发者_运维知识库 change list.phtml to display all products for the category?


I'm recommed create new extension to display all product;


I agree with Mivec, you have to add you own code in a new Magento module. You'll probably have to rewrite the Mage_Catalog_Block_Product_List::_getProductCollection() to change the default filter.


Actually you can do this:

$catid = "191";

$_productCollection = Mage::getResourceModel('catalog/product_collection')  
->addAttributeToSelect(array('name', 'price', 'small_image', 'status'), 'inner')  
->addCategoryFilter(Mage::getModel('catalog/category')->load($catid)); 
    $_helper = $this->helper('catalog/output');

<div id="featured-products">
       <ul id="mycarousel" class="jcarousel-skin-tango">
               <?php foreach ($_productCollection as $_product): ?>
               <li><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(75); ?>" width="75" height="75" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a></li>
               <?php endforeach ?>
       </ul>
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消