5

I need to add custom variable to new order E-mail.

This variables are custom customer attributes.

Thanks in advance!

Bizboss
  • 7,792
  • 27
  • 109
  • 174

1 Answers1

10

Like any other variable that you are using you can ask variables from your object so if you do in php

<?php echo $customerObject->getMyCustomVariable();?>

you would do in template

{{var customerObject.getMyCustomVariable()}}

And as in php side you have to be sure that this attribute exists in your object and is included in collection

Anton S
  • 12,750
  • 2
  • 35
  • 37
  • 3
    I have created a cutom function to do that : ` public function getCustomerKundennummer() { if (!$this->getCustomerId()) return; $customer = Mage::getModel('customer/customer')->load( $this->getCustomerId()); $kundennummer = $customer->getData('kundennummer'); return ($kundennummer); } ` and in my template : `{{var order.getCustomerKundennummer()}}` Thank you for help :) – Bizboss Sep 09 '11 at 10:08
  • vote it up if it helps you then others will find the solution more easily – Anton S Sep 09 '11 at 10:14
  • 2
    Where did you place this public function? – Bob van Luijt Oct 14 '13 at 18:39
  • The following function can be inserted in: ../Mage/Sales/Model/Order.php. – Leonidas Mar 06 '15 at 10:25