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!

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

  1. Mike says:

    Your Awesome! Thanks! I did both fixes and didn’t realize all I needed was the latest fix..

    Works perfect.

    Mike

  2. What worked best for me: 1) simply replace my original app/design/frontend/default/default/layout/catalog.xml with the one of the new 1.4.0.1 release app/design/frontend/base/default/layout/catalog.xml
    (This is actually per “Upgrade notes” here: http://www.magentocommerce.com/download/release_notes#Release Notes – Magento 1.4.1.0 stable (June 10, 2010) )
    2) Do the fix as in the “Update” in this article here above, about extends Mage_Page_Block_Html_Pager (That one they didn’t tell…)
    Doing that way, I had no problem of grid being changed into list, the layout is exactly as it was originally.

  3. neetha says:

    thanks a lot it worked .. :)

  4. Nice post and this mail helped me alot in my college assignement. Say thank you you on your information.

  5. just never think these things will work, but thank god they do!

  6. Lee Marriott says:

    Thanks for this, its been puzzling me for days and I finally found this answer and it worked!

Leave a Reply


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