Magento用户帐户和心愿单错误

时间:2014-03-03 20:53:12

标签: php magento

我最近在Magento 1.7.0.2安装的“我的帐户”和“我的愿望清单”页面上遇到以下错误:

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}

我假设错误出现在我的某个模板文件中,但我一直很难找到它,有人可以解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

链接将添加到布局xml文件中。搜索<action method="addLink"以展示它们。

参见例如 app/design/frontend/base/default/layout/newsletter.xml第51行

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

(您将识别出现在错误消息数组中的三个值)和 app/design/frontend/base/default/layout/wishlist.xml第54行

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

查看您的错误消息,它看起来像主题xml中的某个位置,希望在主题的layout.xml文件中,此<action method="addLink" ... </action>已添加到类型为Mage_Page_Block_Html_Footer的块引用中,即<action method="addLink"...>位于<block type="page/html_footer"...>下,但该类没有addLink()方法。 addLink()例如Mage_Customer_Block_Account_Navigation<block type="customer/account_navigation"...>

最简单的方法是将简报链接移出page/html_footer类型块并进入customer/account_navigation类型块(或echo the link directly in your .phtml file