注文に仮想製品が含まれている場合は、メールテンプレートにテキストを追加する

magento.stackexchange https://magento.stackexchange.com//questions/43222

  •  12-12-2019
  •  | 
  •  

質問

仮想製品機能を使用してチケットを販売しています。したがって、仮想製品が存在する場合にのみ、電子メールテンプレートにテキストを追加します。これは可能ですか?

役に立ちましたか?

解決

より簡単な方法の1つは、PTHMLファイルをあなたのEメールに含めることです

メールテンプレートにテキストを表示する場所には、以下のコードを追加する

{{block type='core/template' area='frontend' template='<module_name>/orderemail.phtml' order=$order}}
.

あなたのテンプレートファイル/ OrderEmail.phtml

$_order = this->getOrder()
$hasVirtual = false;

 $items = $order->getAllVisibleItems();
 foreach($items as $i){
    if( $i->->getIsVirtual()){
         $hasVirtual = true;
    }
 }

 if($hasVirtual){
    echo 'text here
 }
.

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top