Show text from custom field in email

  • Posts: 330
  • Thank you received: 21
  • Hikaserial Standard Hikashop Business
2 months 1 day ago #337462

-- HikaShop version -- : 4.4.4
-- Joomla version -- : 3.10.3
-- PHP version -- : 7.4

Hi
I sell some event tickets and would like to show some ticket info to buyers ind the email they receive, but only when the status is confirmed or sent.

I have made a custom field, added default text and restricted it to certain categories, but I can figure out how to get it to show ONLY in the the Confirmed and/or Sent emails.

Any suggestions?

Regards
Thomas

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

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
1 month 4 weeks ago #337494

Hi,

When you edit the order status notification email via the System>Emails menu, you have a "per status override" button for the HTML version.
So you can use that button to select a status and add the tag for your custom field in the HTML version for that order status only.

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

  • Posts: 330
  • Thank you received: 21
  • Hikaserial Standard Hikashop Business
1 month 4 weeks ago #337516

Hi
Perfect, will give it a try :-)

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

  • Posts: 330
  • Thank you received: 21
  • Hikaserial Standard Hikashop Business
1 month 4 weeks ago #337517

How can I force the default text in the custom field to appear on the order?



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

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
1 month 4 weeks ago #337551

Hi,

There is no option for that.
The default text is only what's displayed in the field by default.
In that case, you would need to add some custom PHP code to the HTML section of the email.
Something like that:

<?php if(empty($data->cart->ticketinfo))
 echo 'my default text';
else
echo $data->cart->ticketinfo;
?>

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

  • Posts: 330
  • Thank you received: 21
  • Hikaserial Standard Hikashop Business
1 month 4 weeks ago #337554

So I have to hardcode the text in the template?
Just to be sure :-)

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

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
1 month 4 weeks ago #337555

Hi,

That would be the simplest. You could also add a few lines of PHP code to load the settings of the custom field and display the default text. But you need a PHP developer to work on that for you if that's what you want.
I suppose directly writting the text in the HTML of the email is good enough.

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

  • Posts: 330
  • Thank you received: 21
  • Hikaserial Standard Hikashop Business
1 month 4 weeks ago #337561

Thank you Nicolas - it's a great solution!

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

Time to create page: 0.069 seconds
Powered by Kunena Forum