I'm attempting to add layered navigation to a CMS page containing a widget that contains a custom product collection (products that are 'new'). Within this widget are fuctions that, given the correct parameters, will filter this collection. How do I pass this collection to the layered navigation block and have it's attributes show up?
This is how I am calling the layered navigation in the CMS custom layout XML:
<reference name="content">
<!-- Layered Navigation Block -->
<block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml" >
<block type="cms/block" name="cms_badges">
<action method="setBlockId"><block_id>cms_mustang_badges</block_id></action>
</block>
</block>
</reference>
This is how i'm calling the product collection onto the CMS page:
{{widget type="catalog/product_widget_new" display_type="new_products" show_pager="1" products_count="60" template="catalog/product/widget/new/content/new_grid.phtml"}}
This is how i'm generating the product collection:
protected function _getProductCollection()
{
$todayStartOfDayDate = Mage::app()->getLocale()->date()
->setTime('00:00:00')
->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
$todayEndOfDayDate = Mage::app()->getLocale()->date()
->setTime('23:59:59')
->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
/** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$this->_addProductAttributesAndPrices($collection)
->addStoreFilter()
->addAttributeToFilter('news_from_date', array('or' => array(
0 => array('date' => true, 'to' => $todayEndOfDayDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left')
->addAttributeToFilter('news_to_date', array('or' => array(
0 => array('date' => true, 'from' => $todayStartOfDayDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left')
->addAttributeToFilter(
array(
array('attribute' => 'news_from_date', 'is' => new Zend_Db_Expr('not null')),
array('attribute' => 'news_to_date', 'is' => new Zend_Db_Expr('not null'))
)
)
->setPageSize($this->getProductsCount())
->setCurPage(1);
return $collection;
}