0

i used the new customer registration field guide from here: (Thanks @Marius) https://magento.stackexchange.com/a/65760/47305

Works fine but is it possible to add the new created custom field in customer_registration_admin.html email template too ?

The install script used for the new field:

<?php
$this->addAttribute('customer', 'callback', array(
'type'      => 'varchar',
'label'     => 'Rückruf',
'input'     => 'text',
'position'  => 120,
'required'  => false,//or true
'is_system' => 0,
));
$attribute = Mage::getSingleton('eav/config')->getAttribute('customer','callback');
$attribute->setData('used_in_forms', array(
'adminhtml_customer',
'checkout_register',
'customer_account_create',
'customer_account_edit',
));
$attribute->setData('is_user_defined', 0);
$attribute->save();

Thanks !

1

You can customize the Transactional Email by adding additional variables. Take a look at the examples at:

"/app/locale/en_US/template/email/*"

If its an email template that already has defined the customer model, you should be able to access the new attribute value directly in the email by referencing the {{var customer.getCallback()}}. You don't even need to create a custom one if its a simple data value... just editing the transactional template in the Magento Admin (System > Transactional Emails). However if its any more complex that a straight copy dump of the attribute data, then it would require more work (but is certainly possible).

  • Thanks a lot !!! Working fine, any way to also add the telephone number ? Tried different placeholders i just googled but i think this is not available for registration transactional email ? – w00druFF Nov 18 '16 at 17:27
  • Telephone number is part of the Customer Address info. Magento actually has support to include (require) address info at registration but it isn't exposed... you would need to update the class Mage_Customer_Block_Form_Register and set the 'show_address_fields' to true. Look at the answer of stackoverflow.com/questions/26050724/… to set this value via Layout, or you could use a Block class rewrite. – Phil M Nov 18 '16 at 17:58
  • Of course the other option is to add another customer attribute for "Primary Telephone". Magento's design for telephones linked to addresses was created when only a few people were using cell phones as their primary contact number (Magento 1.3 was released in 2009). – Phil M Nov 18 '16 at 18:04
  • Hey thanks again but i already have address, telephone, company and some other fields in the registration form, maybe i missunderstand you but i want to add telephone to the transactional email like we just did with the callback field. Tried with "{{var customer.getAddresses().getTelephone()}}" in the email template but just get "Array" as output. – w00druFF Nov 18 '16 at 21:38
  • Try customer.getDefaultBillingAddress().getTelephone() – Phil M Nov 18 '16 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.