0

I'm running accross a situation here.

As far as I know, in previous versions of Magento, if one got this PHP fatal error message:

Fatal error: Call to a member function toHtml() on a non-object in C:\xampp\htdocs\magento\app\design\frontend\base\default\template\wishlist\view.phtml on line 50

You should do a simple change in page.xml file, so that :

<block type="core/profiler" output="toHtml"/>

would become:

<block type="core/profiler" output="toHtml" name="core_profiler"/>

But now... running Magento 1.7 this solution doesn't seem to work anymore!

Anybody has a solution for that?

Thanks in advance!

1
  • what's on your wishlist/view.phtml line 50?
    – Kalpesh
    Aug 12, 2012 at 19:55

2 Answers 2

7

This is a perfect example of why people should use local.xml for base theme layout overrides!

The problem is that when working with your previous verison of Magento, at some point you copied over wishlist.xml from the base theme to your custom theme and not the wishlist template files.

There were some new blocks added to the the wishlist layout between version 1.6 and 1.7.

Line 50 of wishlist/view.phtml is trying to call toHtml on a child block named control_buttons...

<?php echo $this->getChild('control_buttons')->toHtml();?>

This block was only introduced in 1.7, so the wishlist.xml file you have from a previous version does not declare that block - hence the error " Call to a member function toHtml() on a non-object"

So, to resolve this you need to try and merge the 1.7 base wishlist.xml file with your customized verion - essentially adding in the new blocks declared in 1.7.

1.6 wishlist.xml here

1.7 wishlist.xml here

1
  • This solution worked fine! Thanks Drew. When I grow up in Magento I wanna be just like you man :p hehe Aug 13, 2012 at 4:18
3

It's obvious, that your problem is not related with, the xml layout directive, that you've mentioned:

<block type="core/profiler" output="toHtml" name="core_profiler"/>

The fatal error is fired on line 50 in file app\design\frontend\base\default\template\wishlist\view.phtml

I guess, that you have updated your magento installation recently.

Can you please do the next experiment:

  1. In your active theme temporary rename layout/wishlist.xml to layout/wishlist-back.xml
  2. Clean up Magento cache
  3. Try to reproduce the problem again
  4. Share with us the result
2
  • The question about the block tag is correct! Thanks Ceckoslab! Aug 13, 2012 at 4:19
  • 2
    Hi @GilbertoAlbino is it possible to mark the suggested solution of Drew Hunter as accepted. As I see he just gave better explanation of the problem. For sure his solution is easier to understand by other people.
    – ceckoslab
    Aug 13, 2012 at 7:45

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.