Question

I have recently encountered the following error on both "My Account" and "My Wishlist" pages of my Magento 1.7.0.2 install:

There has been an error processing your request

Invalid method Mage_Page_Block_Html_Footer::addLink(Array
(
    [0] => newsletter
    [1] => newsletter/manage/
    [2] => Newsletter Subscriptions
)
)

Trace:
#0 [internal function]: Varien_Object->__call('addLink', Array)
#1 [internal function]: Mage_Page_Block_Html_Footer->addLink('newsletter', 'newsletter/mana...', 'Newsletter Subs...')
#2 /home1/root/public_html/app/code/core/Mage/Core/Model/Layout.php(348): call_user_func_array(Array, Array)
#3 /home1/root/public_html/app/code/core/Mage/Core/Model/Layout.php(214): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 /home1/root/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 /home1/root/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#6 /home1/root/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#7 /home1/root/public_html/app/code/core/Mage/Customer/controllers/AccountController.php(107): Mage_Core_Controller_Varien_Action->loadLayout()
#8 /home1/root/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Customer_AccountController->indexAction()
#9 /home1/root/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#10 /home1/root/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /home1/root/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#12 /home1/root/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#13 /home1/root/public_html/index.php(87): Mage::run('', 'store')
#14 {main}

I am assuming that error is in one of my template files, but I have been having a difficult time finding it, could anyone shed some light?

Was it helpful?

Solution

The links are added in the layout xml files. Search for <action method="addLink" to expose them.

See for example app/design/frontend/base/default/layout/newsletter.xml line 51

<action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>

(you will recognise the three values that appear in the array of your error message) and app/design/frontend/base/default/layout/wishlist.xml line 54

<action method="addLink" translate="label" module="wishlist" ifconfig="wishlist/general/active"><name>wishlist</name><path>wishlist/</path><label>My Wishlist</label></action>

Looking at your error message it looks like somewhere in a theme xml, hopefully in the theme's layout.xml file, this <action method="addLink" ... </action> has been added to a block reference of type Mage_Page_Block_Html_Footer that is, the <action method="addLink"...> is under a <block type="page/html_footer"...> but that class does not have the addLink() method. addLink() is in, for example, Mage_Customer_Block_Account_Navigation ie <block type="customer/account_navigation"...>

So the simplest thing is to move the newsletter link out of the page/html_footer type block and into the customer/account_navigation type block (or echo the link directly in your .phtml file )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top