Using an observer how can i get the current pager block with its loaded product collection on a category page?
I want to check the total number of pages on a category page before it is loaded.
categorycollection;event-observerpager
Using an observer how can i get the current pager block with its loaded product collection on a category page?
I want to check the total number of pages on a category page before it is loaded.
Best Answer
You could try listening to the event
core_block_abstract_to_html_before
and then checking if the block given is of instanceMage_Page_Block_Html_Pager
.This block has a function
getCollection
which would give you the current collection and the functiongetPages
which will give you an array of all the page ids.