2016-05-04 12 views
0

私はMagento CE 1.8.1を使用しています。私は、アカウントがバックエンドから作成されたときにカスタムウェルカム電子メールテンプレートを送信する方法を見つけようとしています。お客様の情報に基づいてチェックされたウェルカム電子メールを送信します。Magento:アカウント情報に基づくカスタムウェルカム電子メールテンプレート

例えば、我々はSales Repと呼ばれるアカウントでこのカスタムフィールドがあります:彼らは顧客をサインアップするときに我々は、当社の営業担当者ごとにカスタム電子メールテンプレートを作成したい、という使い方 enter image description here

をバックエンドから... Sales Repが追加されていない場合、デフォルトのテンプレートが送信されます。

ここではどのモデルやファイルを確認する必要があるのか​​よく分かりませんが、このコードを見つけて開始場所と考えていましたか?

app/code/core/Mage/Adminhtml/controllers/CustomerController.php

// Send welcome email 
      if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) { 
       $storeId = $customer->getSendemailStoreId(); 
       if ($isNewCustomer) { 
        $customer->sendNewAccountEmail('registered', '', $storeId); 
       } elseif ((!$customer->getConfirmation())) { 
        // Confirm not confirmed customer 
        $customer->sendNewAccountEmail('confirmed', '', $storeId); 
       } 
      } 

すべてのヘルプははるかに高く評価されます!

答えて

1

私は私の電子メールテンプレートにPHTMLブロックを追加することで、これを考え出し:

{{block type='core/template' area='frontend' template='mycompany/email/salesrep.phtml' customer=$customer}} 

そして、私は次のディレクトリにブロックを作成しました:

/app/design/frontend/MyCompany/MyTheme/template/mycompany/email/

ここで私が使用したファイルです顧客の販売担当者フィールドに基づいて電子メールに送信する情報を決定する:

販売srep.phtml

<?php 
$customer = $this->getCustomer(); 
$salesrep = $customer->getSalesrep(); 

if (stripos($salesrep, "sales rep 1") !== false) { 
    echo "Your Account Rep is <strong>Sales Rep 1</strong>"; //whatever info here 
} 
if (stripos($salesrep, "sales rep 2") !== false) { 
    echo "Your Account Rep is <strong>Sales Rep 2</strong>"; //whatever info here 
} 

?> 

そして、ここでは電子メールで、最終的な結果であるに: enter image description here

+0

それは私のために働いたと私の一日を保存 –

関連する問題