简体   繁体   English

如何按品牌展示产品

[英]How to display the products by brands

I'm Using magento 1.7.0.2. 我正在使用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. 您应指定要显示的产品的NAMEOFTHECATEGORY,否则可能不会显示所有结果。 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 否则,您将需要一个扩展名,例如http://www.magentocommerce.com/magento-connect/shop-by-brands.htmlhttp://amasty.com/improved-navigation.html这样的扩展名,它非常有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM