Invalid argument supplied for foreach … toolbar.phtml

This article show how to fix the follow Magento Error for Magento 1.4.0.1 :
"There has been an error processing your request
Exception printing is disabled by default for security reasons."

"Invalid argument supplied for foreach … toolbar.phtml "

magento error description

In magento product list page , when select the "Show per page" items , got the error
"There has been an error processing your request
Exception printing is disabled by default for security reasons."
, when this happens , just go to the root/errors
change the local.xml.sample to local.xml .
Refresh the page again , the error become
"Invalid argument supplied for foreach … toolbar.phtml " .

How to fix it

Open app/design/frontend/default/yourtheme/layout/catalog.xml ,add follow line

<block type="page/html_pager" name="product_list_toolbar_pager" template="page/html/pager.phtml" />

after each

<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
</block>

then change each

<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>

to

<action method="setToolbarBlockName"><name>product_list_toolbar_pager</name></action>

After all of this done , just refresh the page , thank god ! It’s work !

Notice

Please make sure disabled all cache when you start work . I also head of some people meet this problem when install magento 1.4 , hope this can help to fix this too but didn’t test . Happy reading !

Update

After post this article , i got same error on shop by brand page , after try many times test , i find a another way : open /public_html/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
if you see

class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Core_Block_Template

just change it to

class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Page_Block_Html_Pager

then update the file . Refresh the page then it work .Hope this can help you !!! Happy reading !!!

Donate

if you find it usefull for you and like it very much , please make a


to help me to write more articles .
Thanks very much.

, I'm a freelancer and available now,if need help just contact me without hesitation.


Tags:
Posted by admin in: magento
  • RSS
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • co.mments
  • YahooMyWeb
  • E-mail this story to a friend!

61 Responses to “Invalid argument supplied for foreach … toolbar.phtml”

  1. Harry Gill says:

    I hit this issue myself and your fix worked like a charm. Thanks.

  2. Brian says:

    It works greate with your updated part !! Thanks.

  3. djowie says:

    adjusting toolbar.php file worked! thnx!

  4. SOSv2 says:

    Idem dito. The Toolbar.php does the trick. Thanks!

  5. Andy says:

    I tried both your methods – the first fixed the error but badly affected the design – for some reason it spoiled the layout of the catalogue summary pages.

    Adjusting the toolbar.php however to extend the alternative class worked perfectly and has had no side-effects.

    I noticed that this problem was also affecting my site-search – and again the change to toolbar.php has fixed the problem.

    Thank you very much for putting this page up – it has saved me an enormous headache. Many thanks.

  6. admin says:

    yes the best way is adjusting the toolbar.php .the fist methods only can remove the error but the second one is real fix for this error.

  7. Alan says:

    Method one worked but then displayed my products in list instead of grid view (even if I set it to grid in the back end).

    Number 2 fixed it perfectly.

  8. Jurga says:

    You’ve just saved tons of my time! thanks :)

  9. 2nd worked like a charm, very quick and solved what I thought would be another big Magento headache A***** Thanks ;)

  10. Pia Andersson says:

    The 2nd option worked an absolute treat :o )

  11. My name is Piter Jankovich. oOnly want to tell, that your blog is really cool
    And want to ask you: is this blog your hobby?
    P.S. Sorry for my bad english

  12. Rene says:

    Thanx,

    Worked perfectly on magento 1.4.0.1

  13. admin says:

    half for hobby half for money.as a freelancer i can get projects form my site.

  14. oneshot says:

    thanks alot, good job. it absolutely fixed my problem!
    Magento 1.4.0.1

  15. Great site. A lot of useful information here. I’m sending it to some friends!

  16. Anis says:

    You actually saved my life

  17. Roger Willis says:

    Thank you so much for your work here. This piece brought my site back to life.

    Roger

  18. Piyaporn K. says:

    The solution can help.
    It worked.
    Thank so much.
    Cool blog!!

  19. GreenSkunk says:

    I actually had to edit the catalog.xml as the Toolbar.php file did not need to be changed.

    One category on the site was returning the error “There has been an error processing your request Exception printing is disabled by default for security reasons.”

  20. admin says:

    “There has been an error processing your request Exception printing is disabled by default for security reasons.”
    this is general error,you need change the local.xml.sample to local.xml . to view the details error
    this is only for details error
    “Invalid argument supplied for foreach … toolbar.phtml ” .

  21. free trial says:

    Good share,you article very great, very usefull for us…thank you

  22. Thanks for this

    information

  23. Really nice and impressive blog i found today.

  24. Thank you for sharing I wish I could go somwhere.

  25. Sinclairfr says:

    Many thanks !

  26. Wisanggeni says:

    Thank you for sharing the solution.
    You’re a life saver!

  27. good share, great article, very usefull for us…thanks!

  28. Nice brief and this post helped me alot in my college assignement. Thank you for your information.

  29. Harrison says:

    Great and perfect. Appreciate your contribution.

  30. My cousin recommended this blog and she was totally right keep up the fantastic work!

  31. Joan says:

    worked for me!
    Thanks!

  32. depa82 says:

    That’s great.. but if you search product there is the same error.. toolbar.phtml…
    I think we can apply your modify to other files.. but wich one file?
    Thanks in advance

  33. depa82 says:

    Ops. it’s work fine…
    i forgot to make 2nd help. ;)
    Thanks alot!!!

  34. Badders says:

    Perfect!
    Thanks!

  35. ed says:

    nice one – thanks a lot …

    worked perfectly.

  36. Rooni says:

    after using the fix i cant see anything, just white screen, i am using the latest magento version, can you help me please.

    Thanks

  37. Wazzu says:

    How is it possible? Why magento team didn’t create a patch for this?
    BTW, Toolbar.php patch did the job ;-)

  38. admin says:

    you maybe do something wrong,did you try the method 2?

  39. Mike says:

    Worked like a charm!

    Thank You

  40. riti says:

    Its worked like a magic with one line. (2nd meth)

    Thanks,
    Riti

  41. Great site. A lot of useful information here. I’m sending it to some friends!

  42. Mohsin says:

    thanks alot dnt know wot id do widout u guys, :)

  43. Genial brief and this enter helped me alot in my college assignement. Gratefulness you seeking your information.

  44. paul says:

    hi, your site really great help, want to ask something after i did both step, my product remain in list i want to make it in grid, i try to set the backend in grid but still nothing change, please advice…

    thanks a lot!

  45. admin says:

    please only use the update part,your site may have other problem,you cant make it show in grid is not caused by this fix.

  46. Genial post and this fill someone in on helped me alot in my college assignement. Gratefulness you for your information.

  47. Mmoore says:

    Worked with one exception, the products display in “list” mode vs. “grid” mode. I have the admin setup to only display “grid” mode in the catalog. Is there anyway to fix this?

    Greatly appreciated.

    Thanks,

    Mike

  48. admin says:

    Worked with one exception, the products display in “list” mode vs. “grid” mode. I have the admin setup to only display “grid” mode in the catalog. Is there anyway to fix this?

    Greatly appreciated.

    Thanks,

    Mike

    did u use the update section fix? that have no effect to other function,in fact the update section fix is codes supposed to be upload,it caused by a small fault of magento team. but they explain structure in the development,that’s where i find the fix way.

Leave a Reply


valid-xhtml10 css2.1 valid © BrightYourSite.com All Right Reaserved