magento - Using customer first name in order confirmation email -
i've seen bunch of articles (mostly 3-5 years old) detailing various methods of getting customer's first name order confirmation email either blank, or unparsed php.
for example this:
<?php echo $this->__('hello, %s', mage::getsingleton('customer/session')->getcustomer()->getfirstname()); ?>
renders in email this:
__('hello, %s', mage::getsingleton('customer/session')->getcustomer()->getfirstname()); ?>
could point me in right direction? on community edition 1.7.
thanks
[edited] can't use php code in email-templates directly. if want insert dynamic data email-templates, have 2 possibilities:
a) in every transactional email can access methods of model, in charge transactional email, is: mails dealing orders, order-model, mails dealing newsletters, newsletter-model , on. can access methods syntax:
{{var model.method()}}
so, in case, access customer's first name in order confirmation email, need suiting method in order model, getcustomerfirstname()
. can call it, following given syntax:
{{var order.getcustomerfirstname()}}
b) can include dynamic data email-template creating custom phtml-template , including email-template via {{block}} directive (as pointed out benmarks in comment below)
Comments
Post a Comment