0

On catalog page there is a block that adds paging navigation - Mage_Page_Block_Html_Pager. It has very useful methods - getPreviousPageUrl and getNextPageUrl.

Is there any way to get values from these functions outside of this block scope, without recreating it second time?

1 Answer 1

1

You should be able to get the instance of a block like this:

$block = Mage::app()->getLayout()->getBlock('block_name_here');

Then just call $block->methodHere()

1
  • That's right, but in the pager case you have to wait for catalog/product_list to start rendering. In fact, catalog/product_list configures the pager block in its method _beforeToHtml(). If you call the snippet above before _beforeToHtml() has executed, you would get no results or even a fatal error.
    – fmrng
    May 24, 2013 at 14:19

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.