2016-07-27 12 views

答えて

2

電子メールと請求書の電子メールで注文商品オプションとカスタムオプションと一緒に、追加の商品属性値を追加する方法を説明します。ここで

は表示され、追加の製品属性を取得するためと請求書の電子メールのために働く必要がコードです:

$productId = $_item->getProduct()->getId(); //for order emails 
//$productId = $_item->getProductId(); //for invoice emails 
$product = Mage::getModel('catalog/product')->load($productId); 
$attributes = $product->getAttributes(); 

//Get a list of all PRODUCT ATTRIBUTES you want to show in this array... 
$dispAttribs = array('hardrive', 'memory', 'processor'); 

foreach ($attributes as $attribute) {  
     $attributeCode = $attribute->getAttributeCode(); 
     if(!in_array($attributeCode, $dispAttribs)) continue; 
     $label = $attribute->getFrontend()->getLabel($product); 
     $value = $attribute->getFrontend()->getValue($product); 
     echo "<br /><strong>" . $label . ":</strong> " . $value; 
} 

項目からカスタムオプションおよび/または項目オプションを表示するために、この使用:

foreach($this->getItemOptions() as $opt) { 
    if(isset($opt['option_id'])) { //for CUSTOM OPTIONS 
      echo "<strong>" . $opt['label'] . ":</strong> ". $opt['option_value'] . "<br />"; 
    } else { //for ITEM OPTIONS 
      echo "<strong>" . $opt['label'] . ":</strong> ". $opt['value'] . "<br />"; 
    } 
} 
をメールを注文するコードを追加するための

、コードが行く必要があるファイルは、次のとおりです。

app/design/frontend/base/default/template/email/order/items/order/default.phtml 
メールを請求書にコードを追加するための

は、コードが行く必要があるファイルは、次のとおりです。代わりにベース/デフォルトの

app/design/frontend/base/default/template/email/order/items/invoice/default.phtml 

、あなたは明らかであるカスタムテーマの場所にそれを置くことができます。

+0

それは魅力のように動作します、ハッサンアリに感謝します – Robert

+0

あなたは私に何か教えてくださいできますか?これをトランザクション電子メールに入れるにはどうにかしていますか? {{var items_productSerialDescription}}のようなものですか? – Robert

+0

このhttps://www.yireo.com/tutorials/magento/magento-theming/1670-customizing-magento-email-templatesをお読みください。ここでは、多国間電子メールのソリューションです。 –

関連する問題