Skip to main content
Notice removed Authoritative reference needed by easymoden00b
Bounty Ended with roman204's answer chosen by easymoden00b
Tweeted twitter.com/#!/StackMagento/status/568458219758227456
added 149 characters in body
Source Link
easymoden00b
  • 1.3k
  • 2
  • 26
  • 55

This is how i'm generating the product collection in the widgets block:

The widget's template page is a standard practice way to display price, reviews, pictures, etc in a pagesize varient format.

This is how i'm generating the product collection:

This is how i'm generating the product collection in the widgets block:

The widget's template page is a standard practice way to display price, reviews, pictures, etc in a pagesize varient format.

deleted 200 characters in body
Source Link
easymoden00b
  • 1.3k
  • 2
  • 26
  • 55
<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>
<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>
<reference name="content">
        <!-- Layered Navigation Block -->
        <block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml" >
        </block>
</reference>
Notice added Authoritative reference needed by easymoden00b
Bounty Started worth 150 reputation by easymoden00b
added 1512 characters in body
Source Link
easymoden00b
  • 1.3k
  • 2
  • 26
  • 55

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'.

Below is the code i'm using to display both the products and layered navigation on CMS pages. However, the layered navigation filter isn't being populated by attributes to allow for filtering.

<reference name="content">
        <!-- Layered Navigation Block -->
        <block type="catalog/layer_view" name="catalog.leftnav" template="catalog/layer/view.phtml" >
                <action method="setCategoryId"><category_id>2250</category_id></action>
        </block>
</reference>

<reference name="content">
        <block type="catalog/product_list" name="home" template="catalog/product/list.phtml">
                <!-- Product List View -->
                <action method="setCategoryId"><category_id>2250</category_id></action>
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <block type="page/html_pager" name="product_list_toolbar_pager"/>
                </block>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
        </block>
</reference> 

category, with id equal to '2250', has it's anchor attribute set to 'yes'.

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;
}
added 78 characters in body
Source Link
easymoden00b
  • 1.3k
  • 2
  • 26
  • 55
Loading
Source Link
easymoden00b
  • 1.3k
  • 2
  • 26
  • 55
Loading