少し検索した後、変更を加えるのに適切なファイルを見つけました。属性の1つとして「companyname」がすでにあるので、このフィールドの値を取得して、次の関数のパラメーターとして渡しました。
app / code / core / Mage / Sales / Model / Order.php
public function sendNewOrderEmail()
{
/*Existing Code*/
if ($this->getCustomerIsGuest()) {
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
$customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
$companyname = $customerId->getCompanyname();
$customerName = $this->getBillingAddress()->getName();
} else {
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
$customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
$companyname = $customerId->getCompanyname();
$customerName = $this->getCustomerName();
}
/*Existing Code*/
$mailer->setTemplateParams(array(
'order' => $this,
'billing' => $this->getBillingAddress(),
'payment_html' => $paymentBlockHtml,
'companyname' => $companyname
));
/*Rest of the code remains the same*/
}
この変更を行った後。このパラメータを含めるようにトランザクションメールを編集しました。配送先住所内に表示したかったので、この行の直前に変数を配置しました
System > Transactional Emails > New Order Email
{{ var companyname }}
{{var order.getShippingAddress.format('html')}}
あなたの会社名が顧客情報の一部として保存されている場合、これは注文メールの最初の「配送先住所」情報に表示されます。
請求書と発送メールについても同じことができます。
これが誰かを助けることを願っています!!! :-)