如何按属性自定义magento过滤图层?

时间:2014-03-15 11:15:53

标签: magento magento-1.8

我如何编码?
 当我按属性desginer进行新的图层过滤时,我按.../catalog/category/designer/name/123

设置网址自定义

我有4个产品显示列表,但是当我点击图层选择尺寸L(2)         我看了4个产品(我希望它的展示2产品过滤器尺寸L)         谁能帮我 ??         这是我的代码

public function designerAction()
        {
        $designer = $this -> getRequest() -> getParam('name');
         $data_designer=array();                   
                        $attributes = Mage::getModel('eav/entity_attribute_option')->getCollection()->setStoreFilter()->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code');
                foreach ($attributes as $attribute) {             
                    if ($attribute->getOptionId()==$designer) {                  
                        $data_designer['name']=$attribute->getValue();
                        $data_designer['desc']=$attribute->getDescription();
                        $data_designer['image']=$attribute->getImage();                   
                    }
                }  
        $collection = Mage::getModel('catalog/product')->getCollection()
                     ->addAttributeToSelect('*')
                     ->addFilter('type_id', 'configurable')                       
                     ->addAttributeToFilter('designer', $designer)  ;

        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);

        $this->loadLayout();

        $listBlock = $this->getLayout()->createBlock('catalog/product_list')
                ->setTemplate('catalog/product/designer.phtml')

                ->setCollection($collection);
        $listBlock->setData('data',  $data_designer);
        $this->getLayout()->getBlock('content')->append($listBlock);

        $this->renderLayout();
        } 

1 个答案:

答案 0 :(得分:0)

不,当我使用属性URL时,我的集合返回左层,当我使用带有属性颜色或大小的左层时,url将设置..... /?color = 3& size = 2

但我的收藏品无法获取网址属性==>我的列表产品不受属性影响