0

数日前にマジェントベースのウェブサイトを購入しました。ページ 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/post/ の場合、次のファイルを編集できたはずです

/app/code/core/Mage/Contacts/controllers/IndexController.php 

しかし、 /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('*/*/');
        }
    }
4

2 に答える 2

1

それはまだそのファイルにあるはずでfunction serviceAction()、IndexController.php の中にあるだけです。そこにない場合は、対応する IndexController.php が app/code/local ディレクトリ内のどこかにあるかどうかを確認します。多くの場合、フォームは連絡先のシステム構成で設定された電子メール アドレスからプルされます。

編集

変更しようとしている行は

Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),

そのアドレスは、システム構成から取得されます。電子メール アドレスをハードコーディングするか、別の構成済み電子メール アドレスに設定することができます。

于 2013-08-12T18:37:27.077 に答える
0

[システム] -> [構成] -> [一般] -> [電子メール アドレスの保存] の管理パネルでアドレスを変更できるはずです。

于 2013-08-12T18:56:58.897 に答える