Magento 1.7.0.2 で顧客へのウェルカム メールの送信を停止したい。できるだけ早く解決策を教えてください。前もって感謝します。
3481 次
1 に答える
8
残念ながら、これは簡単な作業ではなく、Magento 管理者から行う方法はありません。
このウェルカム メールを開始できる場所がいくつかありますが、顧客モデル レベルで停止することができます。この作業を行う関数は Mage_Customer_Model_Customer::sendNewAccountEmail (app/code/core/Mage/Customer/Model/Customer.php 行 587) です。
電子メールを無効にする構成設定を使用して新しいモジュールを作成し、顧客モデル メソッドを拡張して設定を読み取る必要があります。
このようなもの(テストされていないコード、自己責任で使用してください):
モジュールの system.xml で:
<sections>
<customer>
<groups>
<create_account>
<send_welcome_email translate="label">
<label>Send Welcome Email?</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>65</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</auto_group_assign>
</send_welcome_email>
</groups>
</customer>
</sections>
顧客モデルを拡張します。モジュール内の Model/Customer.php
class YourModule_Model_Customer extends Mage_Customer_Model_Customer
{
public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0')
{
if ( ! Mage::getStoreConfig('customer/create_account/send_welcome_email') ) {
return $this;
}
$types = array(
'registered' => self::XML_PATH_REGISTER_EMAIL_TEMPLATE, // welcome email, when confirmation is disabled
'confirmed' => self::XML_PATH_CONFIRMED_EMAIL_TEMPLATE, // welcome email, when confirmation is enabled
'confirmation' => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, // email with confirmation link
);
if (!isset($types[$type])) {
Mage::throwException(Mage::helper('customer')->__('Wrong transactional account email type'));
}
if (!$storeId) {
$storeId = $this->_getWebsiteStoreId($this->getSendemailStoreId());
}
$this->_sendEmailTemplate($types[$type], self::XML_PATH_REGISTER_EMAIL_IDENTITY,
array('customer' => $this, 'back_url' => $backUrl), $storeId);
return $this;
}
}
于 2014-01-28T15:52:00.050 に答える