Magento • Fatal error: Call to a member function getPosition() on a non-object in app/code/core/Mage/Page/Block/Template/Links.php on line 112

Article ID #1157
Revision: 1.2
Last update: 2013-01-24

applies to Magento 1.4.2.0 and newer versions

 

Symptoms

The following error message is shown in Magento frontend:

Fatal error: Call to a member function getPosition() on a non-object in app/code/core/Mage/Page/Block/Template/Links.php on line 112

 

Cause

The error is caused by the following instruction in the layout (you can search app/design/frontend/*/*/layout/*.xml files for a file with such instruction to locate it):

<remove name="wishlist_link"/>

This way was used to remove wishlist link in earlier Magento versions. Since Magento 1.4.2.0 version wishlist_link block is generated directly by the code (addLinkBlock function in app/code/core/Mage/Page/Block/Template/Links.php).

Solution

Simply removing the instruction and flusing Magento cache should solve the issue. However, it will add wishlist link to the links block. If you need to delete the wishlist link from links block in Magento 1.4.2.0, Magento 1.5.1.0 or Magento 1.6 versions and above try the following layout instructions instead:

<layout>
    <default> 
        <reference name="wishlist_link">
            <action method="setTemplate"><template>blank-link.phtml</template></action>         
        </reference>            
    </default>
</layout>

Did this article help you solve your issue?


Average rating: 3.08 (36 votes)

completely useless 1 2 3 4 5 most valuable

Tags: ,