久久久久久久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)
主站蜘蛛池模板: 中文字幕av亚洲精品一部二部 | 1级黄色大片 | 羞羞色在线观看 | 国产精品夜间视频香蕉 | 亚洲色图综合网 | 日韩字幕 | 这里只有精品999 | 91久久久久久 | 成人国产精品久久久 | 国产区精品在线观看 | 日本一区精品 | 亚洲成人一区二区在线 | 成人国产精品一级毛片视频毛片 | 国产精品久久国产精品 | 国产精品视频久久久 | 成人在线免费视频观看 | 一区二区三区四区在线免费观看 | 人人澡人人爱 | 成人久久网 | 日韩免费视频一区二区 | 久久久久国 | 美女爽到呻吟久久久久 | 国产精品高潮呻吟久久久久 | 久久久999免费视频 999久久久久久久久6666 | 在线观看日本高清二区 | 粉嫩av| 欧美一区永久视频免费观看 | 日日噜噜夜夜爽爽狠狠 | 国产一级视频在线播放 | 国产一区二区观看 | 亚洲人成网亚洲欧洲无码 | 久久久久久久久久久久亚洲 | 成人在线一区二区 | 亚洲网站在线观看 | 欧美久久一级特黄毛片 | 欧美一级电影免费 | 激情福利视频 | 国产九九九 | 99久久久无码国产精品 | 天天草草草| 久操国产|