I have a custom list.phtml page. I have copied list.phtml page and rename it to newlist.phtml page. The only difference is I have changed the
$_productCollection=$this->getLoadedProductCollection();
TO
$_productCollection = Mage::getModel('catalog/product')
->getCollection()->addFieldToFilter('status', array('neq' => 2))
->addAttributeToSort('created_at', 'DESC')
->addAttributeToSelect('*')
->load();
And using it by Adding the below in admin content
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/newlist.phtml"}}
AND below in layout update
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" template="catalog/layer/view.phtml"/>
</reference>
But this page does not showing the Layred Nav. But all other page like category pages shows the layred nav. Any idea???
Layered navigation filters are working with Mage::getSingleton('catalog/layer')
object. You are directly finding product collection from catalog model object and this is causing issues here.
See Magento's product collection fetching logic here:
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;
}
Refer- app/code/core/Mage/Catalog/Block/Product/List.php