0

我正在使用 magento 1.7.0.2。我使用此代码按制造商显示产品。但这表明产品按搜索条件。

我需要像这个页面一样在单个页面中显示产品产品(左下角的品牌)

<?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>

谁来帮帮我。提前谢谢....... :)

4

1 回答 1

0

您应该更改网址

<li><a href="<?php echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li> 

至:

<li><a href="<?php echo Mage::getBaseUrl(); ?>NAMEOFTHECATEGORY?manufacturer=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li>  

您应该指定要显示的产品的 NAMEOFTHECATEGORY,否则它可能不会显示所有结果。否则,您将需要像http://www.magentocommerce.com/magento-connect/shop-by-brands.html或这个 http://amasty.com/improved-navigation.html这样的扩展 ,它非常有用

于 2013-10-09T13:55:56.363 回答