I'm Using magento 1.7.0.2. I used this code to display products by manufacturer. but this shows that products by search criteria.
I need show the products products in individual page like this page(brands in left-bottom)
<?php
$product = Mage::getModel('catalog/product');
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', 'manufacturer');
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
?>
<h1>Brands</h1>
<ul id="manufacturer_list">
<?php foreach ($manufacturers as $manufacturer): ?>
<li><a href="<?php echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li>
<?php endforeach; ?>
</ul>
some one help me. thanx in advance....... :)
You should change the URL
<li><a href="<?php echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li>
To:
<li><a href="<?php echo Mage::getBaseUrl(); ?>NAMEOFTHECATEGORY?manufacturer=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li>
You should specify the NAMEOFTHECATEGORY of the products to display, otherwise it might not show all results. Otherwise you would need an extension like http://www.magentocommerce.com/magento-connect/shop-by-brands.html or this one http://amasty.com/improved-navigation.html which it's quite useful