Customer name to appear on email

  • Posts: 209
  • Thank you received: 18
  • Hikashop Business
12 years 10 months ago #19958

Hi,

I'm using the "No registration" method and I need to know how to get the customer's name to appear in the Order Creation Email (Business Ed.) The customer is supplying a first and last name during checkout.

Looking at the code for the email I have changed the field from name to firstname but still no joy.

echo JText::sprintf('HI_CUSTOMER',@$data->customer->firstname);

How do I call the customer's firstname so that the email reads "Hi John," instead of just "Hi ,"

Cheers!

Last edit: 12 years 10 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
12 years 10 months ago #19979

You should try something like that instead:

echo JText::sprintf('HI_CUSTOMER',@{$data->order_addresses[$data->cart->billing_address->address_id]}->address_firstname);

Note for others: The emails can be edited via the menu System->Emails in the business edition.

The following user(s) said Thank You: klimmbimm

Please Log in or Create an account to join the conversation.

  • Posts: 45
  • Thank you received: 2
11 years 11 months ago #48757

nicolas wrote: You should try something like that instead:

echo JText::sprintf('HI_CUSTOMER',@{$data->order_addresses[$data->cart->billing_address->address_id]}->address_firstname);


This code works for me if I leave out the {}.


So I am doing it like this:
          <?php
          $title = @$data->order_addresses[$data->cart->billing_address->address_id]->address_title;
          if($title === "Herr") {
            echo JText::sprintf('Sehr geehrter Herr %s,', @$data->order_addresses[$data->cart->billing_address->address_id]->address_lastname);
          }
          else if($title === "Frau") {
            echo JText::sprintf('Sehr geehrte Frau %s,', @$data->order_addresses[$data->cart->billing_address->address_id]->address_lastname);
          }
          else {
            echo JText::sprintf('HI_CUSTOMER',@$data->customer->name);
          }
          ?>

At the moment I am wondering why it goes through the last "else" in the ORDER_STATUS_NOTIFICATION. It seems that $title is blank. Why? And how to read out the title then?
In the ORDER_CREATION_NOTIFICATION it works fine.

Last edit: 11 years 11 months ago by klimmbimm.

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
11 years 11 months ago #48793

That code is indeed for the order creation notification.
For the order status notification, you will have to use such code instead:
$data->cart->billing_address->address_title
but only AFTER the loadFullOrder function call in the email.

The following user(s) said Thank You: klimmbimm

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum