<?php
foreach($this->getStoreCategories() as $_category)
{
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$collectionnn = Mage::getModel('catalog/product')
->getCollection()
->joinField('category_id','catalog/category_product', 'category_id', 'product_id = entity_id',null, 'left')
->addAttributeToSelect('*')
->addAttributeToFilter('category_id',array('in' => $cur_category->getId()));
foreach($collectionnn as $product)
{
echo "<a href="https://stackoverflow.com/questions/23627152/.$product->getProductUrl().">".$product->getName()."</a><br>";
break;
}
}
?>
4
solved How to get single product from category id in magento? [closed]