Question

In the Magento Front End Developer Certification Test Questions, I found an answer that I didn't understand, precisely the 8.1: "How would you retrieve the customers' name in a transactional email template?"

  1. {{var customer.name}}
  2. {{var customer_name}}
  3. {{customer name}}
  4. {{var getCustomerName()}}

I thought that the correct answer was the first but it was the 2nd.

You can see the 8.1 test question here. The answers are here.

Can someone explain to me?

Thank you so much.

Was it helpful?

Solution

The question is not a great question as it is too ambiguous. There are a range of transactional emails which behave differently.

{{var customer.name}} is definitely used here for the new account confirmation email.

However if you were in the transactional email template for the order confirmation this would not work as you would access the customer name via the order object see

{[var customer_name}} would only work for email templates where the template variable 'customer_name' has been set as the name. A quick search did not yield any results so I am thinking you might be correct and test answer is wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top