Php Magento observer修改当前加载的集合

Php Magento observer修改当前加载的集合,php,magento,Php,Magento,我做了一个简单的观察者,它会触发“目录、块、产品、列表、集合” 我已经尝试过通过Mage::getModel('catalog/category')加载产品,并使用:$observer->getEvent()->setCollection()修改集合,但没有成功。集合始终限于选定的类别。标记[system.reactive]是Microsoft的反应式扩展的.NET命名空间。我认为那不是你想要的。 <config> <global> <modules>

我做了一个简单的观察者,它会触发“目录、块、产品、列表、集合”


我已经尝试过通过
Mage::getModel('catalog/category')
加载产品,并使用:
$observer->getEvent()->setCollection()
修改集合,但没有成功。集合始终限于选定的类别。

标记[system.reactive]是Microsoft的反应式扩展的.NET命名空间。我认为那不是你想要的。
<config>
<global>
<modules>
    <Bz_Customfilter>
        <version>0.1.0</version>
    </Bz_Customfilter>
</modules>
    <events>
        <catalog_block_product_list_collection>
            <observers>
                <Bz_Customfilter_Model_Observer>
                    <type>singleton</type>
                    <class>Bz_Customfilter_Model_Observer</class>
                    <method>Customfiltermethod</method>
                </Bz_Customfilter_Model_Observer>
            </observers>
        </catalog_block_product_list_collection>
    </events>
</global>
class Bz_Customfilter_Model_Observer
{
    public function __construct()
    {
    }

    public function Customfiltermethod($observer)
    {

        if(Mage::registry('current_category') &&(Mage::registry('current_category')->getId()=='103') ):
            $collection=$observer->getEvent()->getCollection();
            $collection->addAttributeToFilter('filter', '1');
        endif;
        return $this;

    }
}