Magento多个phtml联系人表单模板


Magento multiple phtml contact form template

我正在创建多个联系表格并从 http://www.milessebesta.com/web-design/magento-make-multiple-contact-us-forms-and-redirect-them-to-a-separate-thank-you-pages/那里获得想法。

我创建了多个联系表单,用于快速联系多个页面。一个是弹出表单,另一个是另一个联系页面。(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;
            }

问题:

修改后,我仍然无法发送联系我们表格。帖子提交在浏览器中的某个地方停止,当尝试刷新页面时,它会弹出一个警告"确认表单重新提交"。

问题:

导致问题的原因是什么?如何使用我的自定义 phtml 联系表单发送查询电子邮件?

更新

如果您检查该元素,即使我正在使用action="<?php echo $this->getFormAction(); ?>",表单操作值也会丢失

控制器上可能存在 PHP 错误。您应该尝试调试代码。确保错误报告已打开,暂时写入:

   error_reporting(E_ALL);
   ini_set('display_errors', 1);

在索引.php文件的开头。