【问题标题】:Comment on magento contact us form评论magento联系我们表格
【发布时间】:2014-09-10 08:10:27
【问题描述】:

我想将评论作为联系我们页面的可选部分。我已经删除了验证联系我们表单上的评论的类。

<li class="wide">
    <label for="comment"><?php echo Mage::helper('contacts')->__('Comments or Questions:') ?></label>
    <div class="input-box">
        <textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" cols="5" rows="3" ></textarea>
    </div>
</li>

它没有显示任何前端错误,但如果我不写任何评论,我会收到错误消息“无法提交您的请求。请稍后再试”。

TBI 帮助后发现以下错误 -

exception 'Exception' in 
/app/code/core/Mage/Contacts/controllers/IndexController.php:92 Stack trace: #0 
/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Contacts_IndexController->postAction() #1 
/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('post') #2 
/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #3 
/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #4 
/app/Mage.php(683): Mage_Core_Model_App->run(Array) #5 
/index.php(87): Mage::run('default', 'store') #6 {main}

【问题讨论】:

  • 如果出现错误,尝试在控制器中打印发布数据?
  • 为了解决这个问题,我们必须在 /app/code/core/Mage/Contacts/controllers/IndexController.php //if (!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) { // $error = true; //} 的下面更改核心文件注释

标签: php magento-1.8


【解决方案1】:

要解决这个问题,我们必须更改核心文件。 只需在核心的联系模块上注释下面的代码行,路径是 /app/code/core/Mage/Contacts/controllers/IndexController.php

//if(!Zend_Validate::is(trim($post['comment']) , 'NotEmpty')) { // $error = true; //}

希望这对其他人有所帮助

【讨论】:

    【解决方案2】:

    最好覆盖核心文件。

    将其复制到:app/code/local/Mage/Contacts/controllers/ 并对此文件进行更改。这确实可以帮助您了解在尝试使 Magento 为您工作的过程中更改了哪些文件。

    【讨论】:

    • 感谢@Chris K 重播。下次编辑时我会记住这一点
    • 另外,值得为版本控制设置一个 Git 存储库。在开发之间获取已知快照非常有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-25
    • 1970-01-01
    • 2012-08-16
    • 1970-01-01
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    相关资源
    最近更新 更多