Skip to main content
deleted 4 characters in body
Source Link
Manashvi Birla
  • 8.9k
  • 9
  • 28
  • 53

Retrieved the value of this field and pass it as a param in the following function

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();
            $storeID = $customerId->getStoreId();
        } else {
            $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
            $customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
            $customerName = $this->getCustomerName();
            $storeID = $customerId->getStoreId(); // fetch your custom attribute
        }
        
        $mailer->setTemplateParams(array(
          'order'        =>  $this,
          'billing'      =>  $this->getBillingAddress(),
          'payment_html' => $paymentBlockHtml,
          'storeid'  => $storeID 
       ));
     }

After making this change. edit Transactional Email to include this param. Go to System > Transactional Emails > New Order Email and add like below :

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

hen this would get displayed in your Order Email in 'Shipping Address' Information right at the Start

P.S. I would advice you to override the core blocks instead of making changes in the core

Retrieved the value of this field and pass it as a param in the following function

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();
            $storeID = $customerId->getStoreId();
        } else {
            $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
            $customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
            $customerName = $this->getCustomerName();
            $storeID = $customerId->getStoreId(); // fetch your custom attribute
        }
        
        $mailer->setTemplateParams(array(
          'order'        =>  $this,
          'billing'      =>  $this->getBillingAddress(),
          'payment_html' => $paymentBlockHtml,
          'storeid'  => $storeID 
       ));
     }

After making this change. edit Transactional Email to include this param. Go to System > Transactional Emails > New Order Email and add like below :

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

hen this would get displayed in your Order Email in 'Shipping Address' Information right at the Start

P.S. I would advice you to override the core blocks instead of making changes in the core

Retrieved the value of this field and pass it as a param in the following function

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();
            $storeID = $customerId->getStoreId();
        } else {
            $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
            $customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
            $customerName = $this->getCustomerName();
            $storeID = $customerId->getStoreId(); // fetch your custom attribute
        }
        
        $mailer->setTemplateParams(array(
          'order'        =>  $this,
          'billing'      =>  $this->getBillingAddress(),
          'payment_html' => $paymentBlockHtml,
          'storeid'  => $storeID 
       ));
     }

After making this change. edit Transactional Email to include this param. Go to System > Transactional Emails > New Order Email and add like below :

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

hen this would get displayed in your Order Email in 'Shipping Address' Information right at the Start

P.S. I would advice you to override the core blocks instead of making changes in the core

Source Link
Manashvi Birla
  • 8.9k
  • 9
  • 28
  • 53

Retrieved the value of this field and pass it as a param in the following function

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();
            $storeID = $customerId->getStoreId();
        } else {
            $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
            $customerId = Mage::getModel('customer/customer')->load($this->getCustomerId());
            $customerName = $this->getCustomerName();
            $storeID = $customerId->getStoreId(); // fetch your custom attribute
        }
        
        $mailer->setTemplateParams(array(
          'order'        =>  $this,
          'billing'      =>  $this->getBillingAddress(),
          'payment_html' => $paymentBlockHtml,
          'storeid'  => $storeID 
       ));
     }

After making this change. edit Transactional Email to include this param. Go to System > Transactional Emails > New Order Email and add like below :

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

hen this would get displayed in your Order Email in 'Shipping Address' Information right at the Start

P.S. I would advice you to override the core blocks instead of making changes in the core