1

我是 magento 的新手,我在http://www.magentocommerce.com/magento-connect/contacts-form-captcha.html的联系我们页面中安装了一个验证码扩展,但它是社区添加的,我的是企业。

当我访问联系我们页面时,它在我安装的模块中显示索引控制器中的错误,并且在我从社区文件夹和相关 xml 文件中删除了文件夹(recaptcha)之后,我也删除了。但现在它显示错误

Fatal error: Call to a member function setFormAction() on a non-object in /var/www/myapp/app/code/core/Mage/Contacts/controllers/IndexController.php on line 55

第 55 行的代码是

$this->getLayout()->getBlock('contactForm')->setFormAction(Mage::getUrl('*/*/post'));

请帮我查看联系我们页面。

4

3 回答 3

4

I got the mistake what i did and the problem is in my layouts/contacts.xml file.

I am calling the block in my index controller but that block not existed in layout

$this->getLayout()->getBlock('contactForm')->setFormAction(Mage::getUrl('*/*/post'));

'contactForm' block missed in layout

    <contacts_index_index translate="label">
            <label>Contact Us Form</label>
            <reference name="head">
                <action method="setTitle" translate="title" module="contacts"><title>Contact Us</title></action>
            </reference>
                    <reference name="content">
                <block type="core/template" name="contactForm" template="contacts/form.phtml">
            </reference>

 </contacts_index_index>

After adding the above code my problem is solved.

于 2014-08-14T12:50:27.440 回答
0

我也不是专家,但如果您删除了“etc/modules”文件夹中的所有文件,包括 xml 文件,它应该可以工作。尝试清除缓存,看看会发生什么。

于 2014-08-14T05:17:29.470 回答
0

从 admin 以及将在 ( app/etc/modules/namespace_module.xml) 中的 xml 文件中禁用模块,清除 magento 缓存并检查。我想它会帮助你

于 2014-08-13T15:56:25.300 回答