<?php
$categoryid=2;
$collection = Mage::getModel('catalog/category')->load($categoryid)
->getProductCollection()
->addAttributeToSelect('*') // add all attributes - optional
->addAttributeToFilter('status', 1) // enabled
->addAttributeToFilter('visibility', 4) //visibility in catalog,search
->addAttributeToFilter('featured', 1)
->setOrder('position', 'ASC')
->setPageSize(6)
->setCurPage(1);
foreach($collection as $_product){
$productID=$_product->getId();
$_product = Mage::getModel('catalog/product')->load($productID);
echo $_product->getName();
}
?>
$categoryid=2;
$collection = Mage::getModel('catalog/category')->load($categoryid)
->getProductCollection()
->addAttributeToSelect('*') // add all attributes - optional
->addAttributeToFilter('status', 1) // enabled
->addAttributeToFilter('visibility', 4) //visibility in catalog,search
->addAttributeToFilter('featured', 1)
->setOrder('position', 'ASC')
->setPageSize(6)
->setCurPage(1);
foreach($collection as $_product){
$productID=$_product->getId();
$_product = Mage::getModel('catalog/product')->load($productID);
echo $_product->getName();
}
?>
No comments:
Post a Comment