Below is the code i'm usingI'm attempting to display both the products andadd layered navigation onto a CMS pagespage containing a widget that contains a custom product collection (products that are 'new'). However Within this widget are fuctions that, given the correct parameters, will filter this collection. How do I pass this collection to the layered navigation filter isn't being populated byblock and have it's attributes to allow for filtering.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="setCategoryId"><category_id>2250<method="setBlockId"><block_id>cms_mustang_badges</category_id><block_id></action>
</block>
</reference>
<reference name="content">
<block</block>
</reference>
This is how i'm calling the product collection onto the CMS page:
{{widget type="catalog/product_list"product_widget_new" name="home"display_type="new_products" show_pager="1" products_count="60" template="catalog/product/listwidget/new/content/new_grid.phtml">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);
Product List View $todayEndOfDayDate = Mage::app()->getLocale()->>date()
->setTime('23:59:59')
->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
<action method="setCategoryId"><category_id>2250</category_id><** @var $collection Mage_Catalog_Model_Resource_Product_Collection */action>
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$this->_addProductAttributesAndPrices($collection)
<block type="catalog/product_list_toolbar" name="product_list_toolbar"->addStoreFilter()
template="catalog/product/list/toolbar.phtml"> ->addAttributeToFilter('news_from_date', array('or' => array(
0 => array('date' => true, 'to' => $todayEndOfDayDate),
<block type="page/html_pager" name="product_list_toolbar_pager"/> 1 => array('is' => new Zend_Db_Expr('null')))
), 'left')
</block> ->addAttributeToFilter('news_to_date', array('or' => array(
0 => array('date' => <actiontrue, method="setToolbarBlockName"><name>product_list_toolbar</name></action>'from' => $todayStartOfDayDate),
</block> 1 => array('is' => new Zend_Db_Expr('null')))
</reference> ), '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;
}
category, with id equal to '2250', has it's anchor attribute set to 'yes'.