Magento 1.9 PHP Fatal Error – Fix Call to a Member Function setCustomerId() on a Non-Object

magento-1.9PHP

This occurs when a customer clicks the forgotten password link on the
front end; they are sent an email with a link to click and when they
click the link in the email, a blank white page is shown in the
browser or an internal server error such as the following:

Server error The website encountered an error while retrieving
https://www.example.co.nz/customer/account/resetpassword/?id=1271&token=b0e401762edadb425d4cdf65dd412bf9.
It may be down for maintenance or configured incorrectly. Here are
some suggestions: Reload this web page later. HTTP Error 500 (Internal
Server Error): An unexpected condition was encountered while the
server was attempting to fulfill the request.

Best Answer

The solution of above error is very simple. Just remove the customer.xml file used by your theme from /app/design/frontend///layout/. By doing this Magento will use the customer.xml file from the base/default theme.

If you have did some useful changes in customer.xml file according to your theme and not able to remove that file then update your customer.xml file by putting the under given section in it.

<customer_account_resetpassword translate="label">
    <label>Reset a Password</label>
    <remove name="right"/>
    <remove name="left"/>

    <reference name="head">
        <action method="setTitle" translate="title" module="customer">
            <title>Reset a Password</title>
        </action>
    </reference>
    <reference name="root">
        <action method="setTemplate">
            <template>page/1column.phtml</template>
        </action>
        <action method="setHeaderTitle" translate="title" module="customer">
            <title>Reset a Password</title>
        </action>
    </reference>
    <reference name="content">
        <block type="customer/account_resetpassword" name="resetPassword" template="customer/form/resetforgottenpassword.phtml"/>
    </reference>
</customer_account_resetpassword>

That’s it.Now see the result, the error will go away.