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?

Marvin3
  • 639
  • 4
  • 13
  • 26

1 Answers1

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()

Marius
  • 197,939
  • 53
  • 422
  • 830
  • 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 '13 at 14:19