Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Select the manufacturer with more products per each category
 
Aethan
Jr. Member
 
Total Posts:  18
Joined:  2008-07-19
 

Hi all,

I hereby hope someone may help me;

I am trying to list the store categories, putting beside each category’s name the manufacturer’s name which, in that category, has more products associated.

So far, I’ve set up this code:

foreach ($_categories as $_category) :

// here is how I've selected and grouped the category's manufacturers
     
$attributes Mage::getResourceModel('catalog/product_collection')
                 ->
addAttributeToSelect('manufacturer')
                 ->
groupByAttribute('manufacturer')
                 ->
addCategoryFilter($_category);

endforeach;

But the problem is: With the code above I do not take out the number of products associated to each manufacturer. 
How should I do that?

Any suggestion, even different from the one I’m trying to implement, is highly appreciated !!!

Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top