Re: include a custom field in the confirmation emails?

  • Posts: 3
  • Thank you received: 0
13 years 2 weeks ago #12885

I have created a custom field at the bottom of the order process for customers to relay their allergies to food, requests etc. How do I ensure that that info is included in the confirmation email to the customer as well as the email to the administrator?

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
13 years 2 weeks ago #12897

Hi,

Custom order fields will be included in the email to the administrator automatically.
For the email sent to the user, you will have to edit the "order creation notification" email via the menu System->Emails and add the code below in it if you want the user to also have the information in his email :

$fieldsClass = hikashop::get('class.field');
$fields = $fieldsClass->getFields('frontcomp',$data,'order','');
foreach($fields as $fieldName => $oneExtraField) {
	echo "\r\n".$fieldsClass->trans($oneExtraField->field_realname).' : '.$fieldsClass->show($oneExtraField,$data->$fieldName);
}

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

  • Posts: 11
  • Thank you received: 0
13 years 2 weeks ago #12981

Hi

You say that custom emails will be sent in the admin email automatically. All I'm getting in the admin email is the order number and the order total, and a link to the backend for more order details.

If the admin email is supposed to contain all the fields, what am I doing wrong?

And thanks for a great component!

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
13 years 2 weeks ago #12989

Did you create a custom field of the table "order" ?
These custom fields are the ones which go in the email to the administrator. If you created a custom field of the table "address" it will be for the address, not for the order.

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

  • Posts: 3
  • Thank you received: 0
13 years 2 weeks ago #13184

I also found that the actual contents of the order were not in the administrator email. My cheap solution was to copy the code from the creation email and paste it into the administrator email.

I am, however, not able to get the customers name to appear in the administrator email, only the order number. How do I get the customer name to show up in the admin email?

I have also noticed that when people type into my custom field on the front end, the submit button does not do anything the first time you click it. It works once you click it a second time. Any suggestions as this can be confusing for customers.

Cheers

Last edit: 13 years 2 weeks ago by agdinc.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
13 years 2 weeks ago #13205

Like this:

$user = hikashop::loadUser(true);
echo $user->name;

It's for them to verify the information. If you want to change that, you will have to change the code:
$changed = false;
to:
$changed = true;
in the file components/com_hikashop/controllers/checkout.php

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

  • Posts: 228
  • Thank you received: 8
9 years 3 months ago #185208

Hello,

I've got a problem with the address_street2 field in the client and admin Email. It's not included in both admin and client Emails.
The first address_street is included o.k. I went over all the parameters and there is no difference between the two.
I've attached a screen shot of both fields.

Guy.

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 months ago #185210

Hi,

You need to edit the views "order / address_template" (backend template) and "address / address_template" (frontend template) and add the entry:

{address_street2}

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

  • Posts: 228
  • Thank you received: 8
9 years 3 months ago #185373

Thank you Xavier,

I've added the line to the view and it works great.
I've encountered another issue with the same order view. I've created a second phone field for mobile phones. I've added the field and it shows up on the customer login page. But, it is not showing up in the next page with the details.
Checked my DB and the column is there with the right data. It's just not showing in the front end or in the admin and client Emails.

Pleas see attached images.

Thank you again for the quick and kind support.

Guy.

Attachments:
Last edit: 9 years 3 months ago by theguy.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 3 months ago #185438

Hi,

If you use:

<?php echo JText::sprintf('MOBILETELEPHONE','{address_telephone2}");?>
So you have to add a new translation override like:

MOBILETELEPHONE="Phone: %s"


Else you can only use:
{address_telephone2}

Or:
<?php echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone2}");?>

The following user(s) said Thank You: theguy

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

  • Posts: 228
  • Thank you received: 8
9 years 3 months ago #185549

Thank you. That was it :)
Best support EVER!!!

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

  • Posts: 8
  • Thank you received: 0
8 years 9 months ago #205988

HikaShop Business: 2.4.0

I also try to put a custom field in the customer e-mail.
I created a custom field named "address_geburtsdatum".
I tried several variantions to put it to the e-mail which I found on this forum:

{VAR:ADDRESS_GEBURTSDATUM}
{LINEVAR:ADDRESS_GEBURTSDATUM}
{TXT:ADDRESS_GEBURTSDATUM}
{VAR:address.geburtsdatum}
{VAR:address.address_geburtsdatum}

I added {address_geburtsdatum} to address / address_template.php. order / address_template.php is not existing.

Any ideas?

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
8 years 9 months ago #205994

Hi,

You should not change the email code for address custom fields.
As you found on the forum, you need to add the {address_geburtsdatum} tag to both address_template view files.
And they both do exist. If you see only one, it means that you used some of the dropdowns at the top of the views listing to restrict the results. Undo these selections, and only enter "address_template" in the search box and you'll find them.

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

  • Posts: 8
  • Thank you received: 0
8 years 9 months ago #206079

Thank you very much for your advice! I forgot to add it to the backend template...

Could you tell me also how to add the customers E-Mail Adresse to the template?
It would be strange to add another custom field for it, because the user already provides his e-mail during registration. Do you have another hint for me?

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
8 years 9 months ago #206102

Well, it sounds strange to add the display of the email address of the user, since that's his email address where you're sending the email.
You can add such tag in the email template:
{VAR:user.user_email}

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

  • Posts: 8
  • Thank you received: 0
8 years 9 months ago #206207

Hi Nicolas,

the customer has to receive the same version of confirmation mail as the user. Therefore I am just using the confirmation mail and send the same mail vie cc to my client.

I added the line {VAR:user.user_email} but the e-mail didn't contain the users e-mail.

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
8 years 9 months ago #206217

Hi,

I just tried and it is working on our end, the email address is well displayed in the email.
Are you using a guest checkout ? Is the plugin "Redirect Joomla registration to HikaShop plugin" enabled ?

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

  • Posts: 10
  • Thank you received: 0
  • Hikaserial Subscription Hikashop Business
7 years 3 months ago #259292

In regards to the admin receiving the custom order field in the notification email, would you please tell me where to add the below code in the file? A screen shot would be great. Such as between what characters. I am not a coder.
$fieldsClass = hikashop::get('class.field');
$fields = $fieldsClass->getFields('frontcomp',$data,'order','');
foreach($fields as $fieldName => $oneExtraField) {
echo "\r\n".$fieldsClass->trans($oneExtraField->field_realname).' : '.$fieldsClass->show($oneExtraField,$data->$fieldName);
}
Thank you.

Last edit: 7 years 3 months ago by rayjbarrett.

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
7 years 3 months ago #259293

Hi,

This thread is really old (more than 5 years for the first message, more than 1 year for the last one).
I'm afraid that the context is not the same, specially when new feature has been added in HikaShop 2.6 in order to improve the display of custom fields.

You don't need to add such code with recent versions of HikaShop. You can just configure the display settings of your custom field and it will display in the emails.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 7 years 3 months ago by nicolas.

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

  • Posts: 51
  • Thank you received: 2
5 years 9 months ago #294265

Shouldn't this be true also with custom product fields? I've added a couple of custom product fields that I would like to show on the order confirmation email. On the settings for the custom product field I've set all to "Yes" (see pic), but they are not showing on the customer confirmation emal (nor any other email). Any suggestions?

Attachments:

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

Time to create page: 0.149 seconds
Powered by Kunena Forum