1

I need to get current page request size which could be set by an input field named limit. I can get this when it's newly set using getParam('limit') on current request object. But later it seems its value is stored somewhere in the session so I'll miss it. I read about getPageSize() but I don't think it would be helpful here.

What is the best suitable way to get current page size limit?

enter image description here

  • On which version? M1 or M2? – Sukumar Gorai Jul 24 '18 at 8:30
  • @SukumarGorai It's v1.9. – revo Jul 24 '18 at 8:31
  • On which file you want? – Sukumar Gorai Jul 24 '18 at 8:34
  • @SukumarGorai Does it matter? I'm going to have it in an observer within a customized module. – revo Jul 24 '18 at 9:07
  • I think not. Check my answer this will return you the current page size of current product collection – Sukumar Gorai Jul 24 '18 at 9:08
0

You can use the following code to get limit on any page:

<?php $toolbar = new Mage_Catalog_Block_Product_List_Toolbar; ?>
<?php echo $toolbar->getLimit(); ?>

Hope this helps!

  • This actually returns 12 which I think is the default value in an xml file. – revo Jul 24 '18 at 9:35
  • Yes. and if you change the the limit then its also updating. I have checked the same code in my footer and tested. – Sukumar Gorai Jul 24 '18 at 9:38
  • I'm changing it by selecting a number in that drop down list (20,30,50,...) but it always returns 12. However there is no 12 in list. – revo Jul 24 '18 at 9:41
  • Can you clean the cache once. Also can you try to add the above code to your footer.phtml for testing? – Sukumar Gorai Jul 24 '18 at 9:42
  • It shouldn't differ but I did clean the cache now. The output is the same. It's 12. I'm printing this value directly into the page, somewhere that it died within observer method. – revo Jul 24 '18 at 9:44

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.