Magento: formal customer name

http://www.panticz.de/sites/default/files/magento/formal/Customer.php.formal.diff

--- ./app/code/core/Mage/Customer/Model/Customer.php.org	2011-01-19 16:39:12.000000000 +0100
+++ ./app/code/core/Mage/Customer/Model/Customer.php	2011-01-28 17:14:57.000000000 +0100
@@ -193,6 +193,26 @@
         return $name;
     }
 
+    public function getNameFormal()
+    {
+        $name = '';
+        if ($this->getPrefix()) {
+            if ($this->getPrefix() == 'Herr') {
+                $name .= 'Sehr geehrter ';
+            } else if ($this->getPrefix() == 'Frau') {
+                $name .= 'Sehr geehrte ';
+            }
+            $name .= $this->getPrefix();
+            if ($this->getSuffix()) {
+                $name .= ' ' . $this->getSuffix();
+            }
+        } else {
+            $name .= $this->getFirstname();
+        }
+        $name .=  ' ' . $this->getLastname();
+        return $name;
+    }
+
     /**
      * Add address to address collection
      *
1

http://www.panticz.de/sites/default/files/magento/formal/Hello.php.formal.diff

--- ./app/code/core/Mage/Customer/Block/Account/Dashboard/Hello.php.org	2011-01-25 16:49:53.000000000 +0100
+++ ./app/code/core/Mage/Customer/Block/Account/Dashboard/Hello.php	2011-01-25 16:50:40.000000000 +0100
@@ -33,4 +33,9 @@
         return Mage::getSingleton('customer/session')->getCustomer()->getName();
     }
 
+    public function getCustomerNameFormal()
+    {
+        return Mage::getSingleton('customer/session')->getCustomer()->getNameFormal();
+    }
+
 }
1

http://www.panticz.de/sites/default/files/magento/formal/Order.php.diff

--- ./app/code/core/Mage/Sales/Model/Order.php.org	2011-01-25 17:59:53.000000000 +0100
+++ ./app/code/core/Mage/Sales/Model/Order.php	2011-01-28 17:00:52.000000000 +0100
@@ -1511,6 +1511,26 @@
         return $customerName;
     }
 
+    public function getCustomerNameFormal()
+    {
+        $name = '';
+        if ($this->getCustomerPrefix()) {
+            if ($this->getCustomerPrefix() == 'Herr') {
+                $name .= 'Sehr geehrter ';
+            } else if ($this->getCustomerPrefix() == 'Frau') {
+                $name .= 'Sehr geehrte ';
+            }
+            $name .= $this->getCustomerPrefix();
+            if ($this->getCustomerSuffix()) {
+                $name .= ' ' . $this->getCustomerSuffix();
+            }
+        } else {
+            $name .= $this->getCustomerFirstname();
+        }
+        $name .=  ' ' . $this->getCustomerLastname();
+        return $name;
+    }
+
     /**
      * Add New object to related array
      *
1

http://www.panticz.de/sites/default/files/magento/formal/hello.phtml.formal.diff

--- ./app/design/frontend/base/default/template/customer/account/dashboard/hello.phtml.org	2011-01-25 16:44:10.000000000 +0100
+++ ./app/design/frontend/base/default/template/customer/account/dashboard/hello.phtml	2011-01-25 16:56:55.000000000 +0100
@@ -25,6 +25,6 @@
  */
 ?>
 
- <?php echo $this->__('Hello, %s!', $this->htmlEscape($this->getCustomerName())) ?> + <?php echo $this->htmlEscape($this->getCustomerNameFormal()) . "," ?> <?php echo $this->__('From your My Account Dashboard you have the ability to view a snapshot of your recent account activity and update your account information. Select a link below to view or edit information.') ?>
1

http://www.panticz.de/sites/default/files/magento/formal/order_new.html




Hallo {{htmlescape var=$order.getCustomerName()}},vielen Dank für Ihre Bestellung bei {{block type="imprint/field" value="shop_name"}}. Sie können den aktuellen Status Ihrer Bestellung jederzeit in Ihrem Kundenbereich einsehen. Sollten Sie Fragen zu Ihrem Kundenkonto oder Ihrer Bestellung haben, senden Sie uns eine E-Mail an {{block type="imprint/field" value="email"}}. Diese Bestellung wird von uns noch bestätigt, da Münzen zwischenzeitlich vergriffen sein können. Eine Rechnung der lieferbaren Münzen mit Bankdaten senden wir Ihnen separat zu. Ihre Bestellung Nr. {{var order.increment_id}} ({{var order.getCreatedAtFormated(''long'')}}) Rechnungsadresse: Zahlungsmethode: {{var order.getBillingAddress().format(''html'')}}   {{var payment_html}} {{depend order.getIsNotVirtual()}} Versandadresse: Versandart: {{var order.getShippingAddress().format(''html'')}}   {{var order.getShippingDescription()}} {{/depend}} {{layout handle="sales_email_order_items" order=$order}} {{var order.getEmailCustomerNote()}} {{block type="imprint/content" template="symmetrics/imprint/email/footer.phtml"}}   {{block type="cms/block" block_id="mrg_revocation"}}   {{block type="cms/block" block_id="mrg_business_terms"}}
1

ToDo
file: formal.sql.txt ?
fix other "Hallo"s / "Hello"s
cd ./app
grep "getCustomerName()" * -R | grep Hallo

Links
http://www.magentocommerce.com/boards/v../viewthread/37850/P0/