[英]Magento multiple phtml contact form template
我正在创建多个联系表单,并从http://www.milessebesta.com/web-design/magento-make-multiple-contact-us-forms-and-redirect-them-to-a-seperate-thank-获取想法您页面/ 。
我创建了多个联系表单,用于快速联系多个页面。 一个是弹出表单,另一个是另一联系页面。 (PPC目的)
我已经准备了三个以上的.phtml联系人表单模板。 这些模板几乎相同,但是我添加了其他输入形式。它们使用相同的电子邮件模板,并且我使用{{if}} {{else}}指令来获取所需的输入值。 我还创建了目录,并添加了具有.phtml形式的静态块。
我的www.mydomain.com/contacts工作正常,但是静态块中包含的联系表格未在此www.mydomain.com/catalog/another-contact-page
发送该表格。
这是我的表单操作和隐藏的输入。 根据教程。 我必须创建一个隐藏的输入,并带有我想要的URL的值。
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" enctype="multipart/form-data">
<input id="custom_redirect" class="required-entry input-text field" title="<?php echo Mage::helper('contacts')->__('custom_redirect') ?>" type="hidden" name="custom_redirect" value="<?php echo Mage::getBaseUrl(); ?>catalog/another-contact-page">
我也将代码的和平放在我的控制器上
if (!$mailTemplate->getSentSuccess()) {
throw new Exception();
}
$translate->setTranslateInline(true);
if (isset($post['custom_redirect'])) { // If custom_redirect is set
$redirect_url = $post['custom_redirect']; // Get the URL you want to redirect to
$redirect_too = (explode(".com.au/", $redirect_url)); // Explode the Url
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
$this->_redirect($redirect_too[1]); // Redirect to everything everything after .com
return;
} else {
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
$this->_redirect('*/*/');
return;
}
问题:
修改后,我仍然无法发送与我们联系的表格。 帖子提交在浏览器中的某个位置停止了,当尝试刷新页面时,它会弹出警告CONFIRM FORM RESUBMISSION 。
题:
是什么原因引起的问题? 如何使用我的自定义phtml联系人表格发送查询电子邮件?
更新
如果您检查元素,即使我使用action="<?php echo $this->getFormAction(); ?>"
,表单操作值也会丢失action="<?php echo $this->getFormAction(); ?>"
控制器上可能有PHP错误。 您应该尝试调试代码。 确保错误报告已打开,并暂时写入:
error_reporting(E_ALL);
ini_set('display_errors', 1);
在index.php文件的开头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.