I want to do some processing on the products list (the products shown when browsing categories etc) before they are rendered.

I tried using the catalog_product_collection_load_after event, but its called on any products collection used, which include things like recently viewed items, related items, etc. and I only want to react on the time its called for the actual main products list.

I tried to filter the events by checking things like block type/name, controller name, page category etc, but they all proved to be insufficient to distinguish between the event on the main product list and other spam.

so my question:

  1. how can I edit the products list before they are shown via events (eg without editing Magento core code / temlates)?
  2. if your answer is "observe the catalog_product_collection_load_after event": how do I know which of the many product collections loaded is the main products grid?



You can use the event catalog_block_product_list_collection.
This one is dispatched in the product list block.

Your Answer

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

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