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

Search and display manufacturers list for all nested categories/products. 
 
altos
Jr. Member
 
Total Posts:  1
Joined:  2008-07-25
 

I have a list of manufacters based on this code snippet I found in these forums.  I have pasted it below.  This works fine.  However, to build the links to connect them, I need to provide a category id.

Example: /catalog/category/view/manufacturer/17/id/4/
First integer is the attribute id, so in this case it’s the manufacturer “Dummy”.  The last integer is a category id number.  If I use a specific category id number it works, provided there are products directly under that category.  If I use the root category that all my categories are nested under, I get nothing. 

My question is: Can I somehow create a URL that will display all products matching the attribute value?

<?php 
    
            $product 
Mage::getModel('catalog/product');
            
            
$attributes Mage::getResourceModel('eav/entity_attribute_collection'
            ->
setEntityTypeFilter($product->getResource()->getTypeId()) 
            ->
addFieldToFilter('attribute_code''manufacturer')
            ->
load(false);
            
            
$attribute $attributes->getFirstItem()->setEntity($product->getResource()); 
            
//var_dump($attribute);
            /* @var $attribute Mage_Eav_Model_Entity_Attribute */ 
            
$manufacturers $attribute->getSource()->getAllOptions(true);
            
//print_r($manufacturers);
            
foreach($manufacturers as $brand
                
echo "<a href=\"catalog/category/view/manufacturer/" . $brand["value"] . "/id/0/\">" $brand["label""</a><br />"
            

            
        ?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top