在此文件/app/code/core/Mage/Catalog/Block/Product/List.php中

有一个功能

protected function _getProductCollection()
{
    if (is_null($this->_productCollection)) {
        $layer = $this->getLayer();
        /* @var $layer Mage_Catalog_Model_Layer */
        if ($this->getShowRootCategory()) {
            $this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
        }

        // if this is a product view page
        if (Mage::registry('product')) {
            // get collection of categories this product is associated with
            $categories = Mage::registry('product')->getCategoryCollection()
                ->setPage(1, 1)
                ->load();
            // if the product is associated with any category
            if ($categories->count()) {
                // show products from this category
                $this->setCategoryId(current($categories->getIterator()));
            }
        }

        $origCategory = null;
        if ($this->getCategoryId()) {
            $category = Mage::getModel('catalog/category')->load($this->getCategoryId());
            if ($category->getId()) {
                $origCategory = $layer->getCurrentCategory();
                $layer->setCurrentCategory($category);
                $this->addModelTags($category);
            }
        }
        $this->_productCollection = $layer->getProductCollection();

        $this->prepareSortableFieldsByCategory($layer->getCurrentCategory());

        if ($origCategory) {
            $layer->setCurrentCategory($origCategory);
        }
    }

    return $this->_productCollection;
}

它在应用分层导航过滤器后返回产品集合 .

任何人都可以告诉我应用过滤器的位置 .

例如:我有一个属性品牌,它在分层导航中显示 .

如果我为此属性选择一个值,那么Magento会刷新页面并在应用过滤器后返回产品集合 . 上面的函数返回产品集合,但我找不到应用此条件的查询 .

一开始有一条线

$ layer = $ this-> getLayer();

然后在中间某处有一条线

$ this - > _ productCollection = $ layer-> getProductCollection();

这里magento正在调用getProductCollection()函数 . 看看这个功能

public function getProductCollection()
{
    if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) {
        $collection = $this->_productCollections[$this->getCurrentCategory()->getId()];
    } else {
        $collection = $this->getCurrentCategory()->getProductCollection();
        $this->prepareProductCollection($collection);
        $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection;
    }
        echo "<pre>";print_r($collection->getData());die();  //Custom to check collection
    return $collection;
}

我已回复该集合进行调试 . 此集合返回类别集合,而不应用分层导航过滤器 . 我的问题是magento将分层导航过滤器应用于集合的位置 .