久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在訂單電子郵件模板中添加自定義屬性 - Magento

Add custom attribute in order email templates - Magento(在訂單電子郵件模板中添加自定義屬性 - Magento)
本文介紹了在訂單電子郵件模板中添加自定義屬性 - Magento的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我創建了一個公司名稱"屬性,該屬性會添加到我的客戶帳戶信息中,并且是必填字段.

I have created a 'Companyname' attribute which gets added up in my Customer's Account information and is a required field.

它會在注冊、表單和編輯頁面上很好地填寫,并且也會顯示在后端的客戶網格上.

It gets filled up on registration, form and edit pages fine and gets displayed on Customer's Grid in the back-end too.

但是,我無法在我的任何訂單電子郵件模板中顯示公司名稱.

However I am not able to display the Company name in any of my order email templates.

我相信這是因為我的訂單表中既沒有任何名為公司名稱"的列,也沒有任何自定義變量可以傳遞給訂單/發票/發貨模板以在客戶的行旁邊顯示公司名稱名字.

I believe this is because there is neither any column called 'companyname' in my order tables nor do I have any custom variable which I can pass to order/invoice/shipment templates to display Company name right next to the line after Customer's name.

誰能指出我可以在其中創建包含自定義公司名稱"屬性的自定義變量并將其傳遞給所有類型的銷售電子郵件模板的文件

Can any one point out the file where I can create this custom variable containing my custom 'companyname' attribute and pass it to all types of sales email templates

謝謝

推薦答案

經過一番搜索,我找到了可以進行更改的正確文件.由于我已經將公司名稱"作為我的屬性之一,因此我檢索了該字段的值并將其作為參數傳遞給以下函數

After a little bit of searching I found the right file to make the changes. Since I already had 'companyname' as one of my attributes I retrieved the value of this field and passed it as a param in the following function

app/code/core/Mage/Sales/Model/Order.php

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*/
 }

進行此更改后.我編輯了我的交易電子郵件以包含此參數.由于我想在送貨地址中顯示,我將變量放在

After making this change. I edited my Transactional Email to include this param. Since I wanted to display inside Shipping Address, I placed my variable just before this line in

   System > Transactional Emails > New Order Email 

     {{ var companyname }}
     {{var order.getShippingAddress.format('html')}}

如果您的公司名稱被保存為客戶信息的一部分,那么這將顯示在您的訂單電子郵件中的送貨地址"信息中.

If your companyname is getting saved as a part of Customer Information then this would get displayed in your Order Email in 'Shipping Address' Information right at the Start.

您可以對發票和發貨電子郵件執行相同的操作.

You can do the same for Invoice and Shipment Emails.

希望這對某人有所幫助?。?!:-)

Hope this helps someone !!! :-)

這篇關于在訂單電子郵件模板中添加自定義屬性 - Magento的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 色婷婷久久久久swag精品 | 亚洲免费视频网站 | 国产精品国产成人国产三级 | 国产 91 视频| 日韩视频在线观看中文字幕 | 国产在线精品一区 | 久草成人网| 国产精品久久久久久模特 | 欧美一区二区三区精品 | 天天干.com | 国产高清视频在线 | 皇色视频在线 | 女同videos另类 | 日韩第一夜 | 久久免费看 | 亚洲精品一区二区另类图片 | 91av在线看| 国产精品久久久久久久久免费 | www.玖玖玖 | 国产精品久久国产精品 | 一区二区三区中文字幕 | 成人午夜精品 | 久久艹免费视频 | 狠狠操狠狠干 | 成人免费在线播放 | 婷婷激情综合 | 日韩欧美三级 | 国产一区二区三区视频 | 成人高清在线视频 | 男女av| 久久久精彩视频 | 成年人黄色免费视频 | 亚洲天堂av网 | 国产精品亚洲一区二区三区在线 | 欧美性tv| 青青久在线视频 | 狠狠操狠狠干 | 国产精品久久9 | 91热在线 | 中文字幕一区二区三区四区五区 | 免费在线成人网 |