Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Magento更改表单的电子邮件地址_Php_Magento_Magento 1.7 - Fatal编程技术网

Php Magento更改表单的电子邮件地址

Php Magento更改表单的电子邮件地址,php,magento,magento-1.7,Php,Magento,Magento 1.7,几天前我买了一个基于magento的网站。 网页website.com/service中有一个表单 后端中的实际代码是: {{block type="core/template" name="serviceForm" form_action="/contacts/index/service" template="contacts/form_service.phtml"}} 在前端是 <form method="post" id="contactForm" action="/contact

几天前我买了一个基于magento的网站。 网页website.com/service中有一个表单
后端中的实际代码是:

{{block type="core/template" name="serviceForm" form_action="/contacts/index/service" template="contacts/form_service.phtml"}}
在前端是

<form method="post" id="contactForm" action="/contacts/index/service">
但是我找不到任何可以编辑/contacts/index/service的文件。 我认为表单正在按照它告诉我的那样工作

您的询问已提交,将尽快答复。感谢您联系我们

在提交表单后将我重定向到某个页面。
因此,我基本上想编辑电子邮件,并需要您的帮助,以找到文件的位置

@aynber为我找到了功能,但我似乎找不到电子邮件

public function serviceAction()
    {
        $post = $this->getRequest()->getPost();
        if ( $post ) {
            $translate = Mage::getSingleton('core/translate');
            /* @var $translate Mage_Core_Model_Translate */
            $translate->setTranslateInline(false);
            try {
                $postObject = new Varien_Object();
                $postObject->setData($post);

                $error = false;

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

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

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

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

                if ($error) {
                    throw new Exception();
                }
                $mailTemplate = Mage::getModel('core/email_template');
                /* @var $mailTemplate Mage_Core_Model_Email_Template */
                $mailTemplate->setDesignConfig(array('area' => 'frontend'))
                    ->setReplyTo($post['email'])
                    ->sendTransactional(
                        Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
                        Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
                        Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
                        null,
                        array('data' => $postObject)
                    );

                if (!$mailTemplate->getSentSuccess()) {
                    throw new Exception();
                }

                $translate->setTranslateInline(true);

                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;
            } catch (Exception $e) {
                $translate->setTranslateInline(true);

                Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
                $this->_redirect('*/*/');
                return;
            }

        } else {
            $this->_redirect('*/*/');
        }
    }

它应该仍然在该文件中,它将只是IndexController.php内部的
function serviceAction()
。如果没有,请查看app/code/local目录中是否有相应的IndexController.php。表单通常从联系人下的系统配置中设置的电子邮件地址提取

编辑

你想要改变的路线是

Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),

该地址从系统配置中提取。您可以硬编码电子邮件地址,或将其设置为另一个配置的电子邮件地址。

您应该能够在系统->配置->常规->存储电子邮件地址的adminpanel中更改地址。

谢谢,使用serviceAction功能更新了帖子,但我仍然看不到编辑电子邮件的方法。好的,但我现在只得到4个参数,但最初有12个。我和firebug检查了所有参数的实际post。参数作为表单字段,还是其他什么?查看一下您正在使用的电子邮件模板,看看它是如何设置的,并确保它正确地获取了post字段。默认的电子邮件联系人模板可以在系统->事务性电子邮件下找到。如果您没有看到联系人表单,请单击添加模板->联系人表单->加载模板,您可以添加其余的数据。谢谢,但我当前的列表为空。
Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),