Magento – Transactional emails templates instead of Title ” Hallo ” ” Dear ” etc..

By nature brings Magento templates for transactional emails with the general salutation “Hallo” with. This may be one or the other be too general and impersonal.

So it was with us. Thus we have the address in the first step only “Dear / r” erstetzt and set in the backend, that the registration or. to purchase the Title “Mr. or Ms.” selected to be. Now, there is still the first name, so then in the address “Dear / r Mr. John Doe” is. Again, this is not optimal.
Now you can leave with some effort, only show the last name, but this can be left with the following description also, because it is also perfectly. “Dear Mr. Doe” or “Dear Ms. Doe” is then possible.

And this is a small extension, but is not installed via Magento Connect, but be blown up manually.

I am passing on to the original thread:

Hallo,
even if the thread has been inactive for a bit longer but I'll add my two cents, I correct and “personalized” Title to the transaction email to keep important. “Hallo Herr Max Mustermann” pushed me to funny.
So I have a tiny (and perhaps awkwardly written ) Module created, so that customers and guests in the future as “Dear Mr. Doe” or “Dear Ms. Doe” etc.. be addressed – the registered both as a customer as a guest in customer order confirmation, Versandbenachrichtung and invoice. I also have the address for customers in the welcome email and mail passwords etc. some “doctored”.
The module I've attached a file.

Installation: The folder “Memory” nach app / code / local, the file “Anrede.xml” move to app / etc / modules.
In the backend system under>Cache management Cache Update.

If you look at the code will determine: There are really only IF statements. For Whom the prefixes (Salutations =) Mr. and Mrs. can not even be enough simply to add new queries.
Now comes the “important” Part:

The adaptation of the email templates. A couple of placeholders must be replaced. And this:

In System-Emails (Welcome message, Notification of password changes, etc.)
var=$customer.name must be replaced with var=$customer.nameFormal (is “Dear Mr. Doe”) or. var=$customer.nameFormalShort (is “Mr. Smith”)
Transaktions-In Emails (Order confirmation, Shipping Notification, Accounting, etc.)
var=$order.getCustomerName() must be replaced with var=$order.getCustomerNameFormal() (is “Dear Mr. Doe”)

Here is the file (Zip gepackt) File

Version used 1.4.1.1
Found in: http://www.magentocommerce.com/boards/viewthread/37850/P15/

Small addendum dated 03.02.2011:

As already written above, Title, other types of relative. are simply added. Unfortunately, it took some time but, until it was clear, as it is to accomplish.

1. In the backend system under > Configuration > Customer > Customer configuration > Name and address options set up the other desired prefixes. We here present prefix for Austria: Mr.;Dr.;Mr. Ing;Herr Mag.;Mrs.;Dr.;Frau Mag.;Mrs. Ing.

2. Saving.

3. The order.php file in the folder / app / code / local / Ricordo Open / Title / Model / Sales and each has its own Title “if” Fnction. For o.g. Then the styling looks like this (as. from line 18):

if ($this->getBillingAddress()->getPrefix()) {
if ($this->getBillingAddress()->getPrefix()== 'Woman') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
if ($this->getBillingAddress()->getPrefix()== 'Dr.') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
if ($this->getBillingAddress()->getPrefix()== 'Frau Mag.') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
if ($this->getBillingAddress()->getPrefix()== 'Ms. Ing') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
if ($this->getBillingAddress()->getPrefix()== 'Master') {
$customerName formally. = 'Dear'. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
if ($this->getBillingAddress()->getPrefix()== 'Dr.') {
$customerName formally. = 'Dear'. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
if ($this->getBillingAddress()->getPrefix()==’Herr Mag.’) {
$customerName formally. = 'Dear'. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
if ($this->getBillingAddress()->getPrefix()== 'Ing') {
$customerName formally. = 'Dear'. $this->getBillingAddress()->getPrefix() . ‘ ‘;
}
$customerNameFormal .= ‘ ‘ . $this->getBillingAddress()->getLastname();
if ($this->getBillingAddress()->getSuffix()) {
$customerNameFormal .= ‘ ‘ . $this->getBillingAddress()->getSuffix();
}
}
} else {
if ($this->getCustomerPrefix()) {
if ($this->getCustomerPrefix()== 'Woman') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Dr.') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Frau Mag.') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Ms. Ing') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Master') {
$customerNameFormal .= ‘Sehr geehrter ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Dr.') {
$customerNameFormal .= ‘Sehr geehrter ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()==’Herr Mag.’) {
$customerNameFormal .= ‘Sehr geehrter ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Ing') {
$customerNameFormal .= ‘Sehr geehrter ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Count') {
$customerNameFormal .= ‘Sehr geehrter ‘. $this->getCustomerPrefix() . ‘ ‘;
}
if ($this->getCustomerPrefix()== 'Family') {
$customerNameFormal .= ‘Sehr geehrte ‘. $this->getCustomerPrefix() . ‘ ‘;
}
$customerNameFormal .= ‘ ‘ . $this->getCustomerLastname();
if ($this->getCustomerSuffix()) {
$customerNameFormal .= ‘ ‘ . $this->getCustomerSuffix();
}
}
}
return $customerNameFormal;
}

}

4. It is important here, to pay attention to the brackets, that once there is a full clip for all the functions and then if one clip.

5. Saving and re-upload. Then the Magento cache empty.

6. Now confirmation emails come with any kind of salutation by.

7. In addition we have also adjusted the customer.php file in the folder / app / code / local / Ricordo / Title / Model / Customer, that looks like this (as. Line 17-53):

$nameFormal = ”;
if ($this->getPrefix()) {
if ($this->getPrefix()== 'Woman') {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
if ($this->getPrefix()== 'Frau Mag.') {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
if ($this->getPrefix()== 'Ms. Ing') {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
if ($this->getPrefix()== 'Dr.') {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
if ($this->getPrefix()== 'Master') {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
if ($this->getPrefix()==’Herr Mag.’) {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
if ($this->getPrefix()== 'Ing') {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
if ($this->getPrefix()== 'Dr.') {
$name formally. = 'Dear'. $this->getPrefix() . ‘ ‘;
}
$nameFormal .= ‘ ‘ . $this->getLastname();
if ($this->getSuffix()) {
$nameFormal .= ‘ ‘ . $this->getSuffix();
}
return $nameFormal;

 

Addendum dated 15.07.2011: How the Title / Prefix translated into different languages, is here declared.

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

4 comments on “Magento – Transactional emails templates instead of Title ” Hallo ” ” Dear ” etc.”

  1. ..that's the nice thing about Magento, somewhere someone has already done 😉

    Many thanks to Ricardo and the webmaster

    Greeting
    Abase

  2. Hallo,

    tolles Tool. Give it it really an update?
    I was initially really excited, I can finally address the customer politely, However, the emails piled up, where no address was written down but just the last name.

    I then got on it (I suspect that at least) that it is the prefix. Either because it was not found, or because all users have posted flauler small.

    One solution would be to query a case insensitivity and, secondly, the Title “Good day” is found in the case that nothing. That just smacks of the last name is executed, is certainly less than optimal.

    Nevertheless, thanks for the extension and perhaps someone has already crafted a solution.

    Greeting Fenghuag

Leave a Reply

Your email address will not be published. Required fields are marked *