On Magento 1.9 I have a category page with produts and static block.

For static block I used a block type="catalog/product_list with a custom template. In the html template I loaded a custom productCollection to filter on a specific category (different from category page).

$_productCollection = Mage::getModel('catalog/product')->getCollection()
->joinField('rating_summary', 'review/review_aggregate', 'rating_summary', 'entity_pk_value=entity_id',  array('entity_type' => 1, 'store_id' => Mage::app()->getStore()->getId()), 'left');
                   ->addFieldToFilter('visibility', array(
                   )) //showing just products visible in catalog or both search and catalog
                   ->addAttributeToFilter('category_id', '498')
//                   ->addAttributeToFilter('attribute_set_id','9')
                   ->addAttributeToSort('sort_order', 'asc') //in case we would like to sort products by price
//                   ->where('price_index.final_price < price_index.price')
                   ->limit(8) //we can specify how many products we want to show on this page
//                        ->order(new Zend_Db_Expr('RAND()')) //in case we would like to sort products randomly


$_helper = $this->helper('catalog/output');

When I try to sort, change pagination or use layered navigation, Magento changes also the product list in the static block. Why?

  • stackoverflow.com/a/28444299/158325 You'll need to adjust the layer model as well which is keep track of session, filter options, settings, etc. – B00MER Oct 3 '18 at 19:14
  • try renaming your custom product collection Replace '$_productCollection' with '$customProductCollection' or sth – Yiorgos Moschovitis Oct 4 '18 at 15:27
  • @YiorgosMoschovitis: I tried with $_productCollection2 with no success – domfitty Oct 5 '18 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.