Magento in a Subdirectory Error
Recently we installed magento 1.4.1.1 into a subdirectory and we presented with the following error:
“Fatal error: Call to a member function toHtml() on a non-object in /var/www/vhosts/xxx/httpdocs/shop/app/code/core/Mage/Core/Model/Layout.php on line 529″
The main reason for this error is quite simple yet something of a bug. Don’t bother going to the php file in question – you should not change anything there.
In the newer versions of magento they have changed the way childHtml and therefore Block elements are called out. They now require a name feature. When magento is installed it uses the default/default theme. This is where the error comes from.
In your default/default/layout/page.xml you will find a line (possibly line 91) that reads like this:
<block type=”core/profiler” output=”toHtml” />
It should read like this:
<block type=”core/profiler” output=”toHtml” name=”core_profiler” />
With the addition of this name attribute all works well – you can even see that it is meant to have it – because if you go to your “base” equivalent you will see the correct line written there.
After you have edited this, clear your cache and your new magento installation should be up and running a treat!
Thanks for visiting our magento blog at ecommerce website design!
