I'm adding a custom block that will reside on frontend pages which contain a Product List (catalog_category_view, catalogsearch_result_index, etc). The block needs to know which products are being displayed to the user.

I hoped to find an equivalent of the current_product registry item that's used on a product page; however so far I haven't found where I can readily retrieve this.

At the moment I'm handling the core_block_abstract_to_html_after event and then getting the collection from the Pager block:

public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
    $block = $observer->getEvent()->getBlock();
    if (!$block instanceof Mage_Page_Block_Html_Pager) {

    /** @var Mage_Page_Block_Html_Pager $list */
    $list = $block;
    $products = $list->getCollection();

    Mage::register('current_products', $products);

Have I reinvented the wheel? Is there a built-in option, or a better approach?

1 Answer 1


STw,i don't thought that using core_block_abstract_to_html_after event,using !$block instanceof Mage_Page_Block_Html_Pager ,you did not get any product collection,because of:

For every product collection ,pager block does not called like related product collection at product details page, crossell products at checkout page.

So suggestion to use different for example:

Search & category pages,you can use: catalog_block_product_list_collection

Also,you use catalog_product_collection_load_after event which is called at every product collection.But just be carefull that You need fire this event for only frontend Area. other


Note: that is my thought.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.