Hello,
I'm using this code to get Magento manufacturers' label in current category page. (to show brands related to current category not all the brands):
$category = Mage::registry('current_category'); $layer = Mage::getSingleton('catalog/layer'); $layer->setCurrentCategory($category); $attributes = $layer->getFilterableAttributes(); $manufacturers = array(); foreach ($attributes as $attribute) { if ($attribute->getAttributeCode() == 'manufacturer') { $filterBlockName = 'catalog/layer_filter_attribute'; $result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init(); foreach($result->getItems() as $option) { $manufacturers[$option->getValue()] = $option->getLabel(); } } }
I've added above code in a custom phtml file and add an custom cms block to category page pointing to this phtml file.
Actually it works fine in category pages. All I need is to get manufacturer IMAGE instead of their LABEL.
By the way I've used var_dump($option) to find the image or image url, but there is no such a thing for $option!
Please help me what to do.
Thanks
You'll have to extend Mage_Catalog_Model_Layer in order to modify this function:
public function getFilterableAttributes() { // $entity = Mage::getSingleton('eav/config') // ->getEntityType('catalog_product'); $setIds = $this->_getSetIds(); if (!$setIds) { return array(); } /** @var $collection Mage_Catalog_Model_Resource_Product_Attribute_Collection */ $collection = Mage::getResourceModel('catalog/product_attribute_collection'); $collection ->setItemObjectClass('catalog/resource_eav_attribute') ->setAttributeSetFilter($setIds) ->addStoreLabel(Mage::app()->getStore()->getId()) ->setOrder('position', 'ASC'); $collection = $this->_prepareAttributeCollection($collection); $collection->load(); return $collection; }
It this attribute collection, you need to include your custom image name. You can check how SQL query looks by logging $collection->getSelect().
Other way would be to put all manufacturer images into media/manufacturer directory, and to add images like 1.jpg, 2.jpg, 3.jpg by manufacturer id, or you can name them by labels, and later you can load render paths to such images like:
$manufacturerImagePath = Mage::getBaseUrl('media') . 'manufacturer/' . $option->getValue() . '.jpg';
or with:
$manufacturerImagePath = Mage::getBaseUrl('media') . 'manufacturer/' . $option->getLabel() . '.jpg'
Of course, this approach is not the best practice, but it can solve the problem to you if you're not able to deal with extending Mage_Catalog_Model_Layer class.
There is a very useful Magento extension that you can leverage. I am using it too in my store and am quite happy with it. This Magento shop by brand extension from FME allows my customers to search for products from a particular brand or manufacturer. I can also create a separate brand page with a title, description, logo etc. There are other very useful features like users can search by alphabetical listings, display prominent brands in featured block, show related brands etc. You can have a look at it for detailed features below.
https://marketplace.magento.com/fme-shop-by-manufacturer-brand.html
As an Online logo maker, I just want to say that this is a fabulous piece of knowledge from your side and I also want to say that keep writing that type of content just for the assistance of the newbie designers who want that type of unique command.
Check Manufacturer Attribute Setup
In your Magento admin, confirm that the Manufacturer attribute is properly configured. It should be visible on the product and enabled for use in category pages.
Enable Attribute for Layered Navigation
Ensure the Manufacturer attribute is used in layered navigation. This allows Magento to filter and group products by brand/manufacturer.
Upload Manufacturer Logos
Prepare image files for each manufacturer (e.g., a logo for r2park) and upload them to your media folder. Use a consistent file name format like the manufacturer name or ID.
Use Category Context
On each category page, Magento knows what category the user is viewing. You can use that to filter the products in that category and get their associated manufacturers.
List Manufacturers in Current Category
For each product shown in the current category, gather the list of unique manufacturers. This way, only logos of manufacturers relevant to that category will appear.
Map Logos to Manufacturer Names
Associate each manufacturer (like park) with its corresponding logo image. You can manage this manually or through a CMS block if preferred.
Display Logos Visually
Place the logos on the category page, ideally above or below the product list. Each logo can act as a clickable filter or simply a brand indicator.
Make Logos Clickable (Optional)
You can link each logo to a brand-specific page or filtered view of the category showing only that manufacturer’s products. Clicking on the park logo could take users to a filtered r2park-only view.
Optimize with Alt Text
Add meaningful alt text to each logo image, such as “R2Park Manufacturer Logo,” to improve accessibility and help with SEO.
Use CMS Blocks for Flexibility
If you prefer a no-code solution, consider creating a CMS static block with manufacturer logos and include it in category layouts conditionally using Magento’s layout XML or admin layout settings.
Use Page Builder (Magento Commerce)
If you're using Magento Commerce with Page Builder, drag and drop image blocks for each manufacturer, and conditionally show them per category using the dynamic block system.
Test with R2Park Example
Suppose your category contains devices from r2park. By following this method, the r2park logo will show only on relevant category pages — offering both brand recognition and a cleaner user experience.