insert the order_token into confirmation email

  • Posts: 3
  • Thank you received: 0
3 days 13 hours ago #367392

-- HikaShop version -- : Business 5.0.3
-- Joomla version -- : 5.0.3
-- PHP version -- : 8.3

I am trying to cutomize the order confirmation email.
I should insert the order_token and a button that sends to external link.
If I understand correctly I have to:
1. Modify the Preload File:
into preload file order_creation.php dd the appropriate PHP code to generate the order token variable:
` $data->order_token = $order->order_token;`
2. Modify the HTML Email Template in System > Emails:
add the order token using: {VAR: order.order_token}
but I read that “VAR” can change from version to version... ???
3. insert a button that sends to a link: any suggestions on how to do it?
can you help me?
Thanks in advance,
Luca

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

  • Posts: 83905
  • Thank you received: 13581
  • MODERATOR
3 days 9 hours ago #367394

Hi,

You don't need the first step.
You can directly use the tag

{VAR:order.order_token}
in the HTML section. The issue with your tag is the space you've added after "VAR:".
And if you want to include it in a link, you can use normal HTML with the tag in it.
For example:
<a href="https://www.google.com/search?q={VAR:order.order_token}">Click this link</a>
When you click on the "Click this link" link of the email, it will open the Google search results page searching for the token of that order.

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

  • Posts: 3
  • Thank you received: 0
3 days 8 hours ago #367399

first of all thank you for your quick response...
ok...
I followed your advice by inserting this code directly into html:
<p>
<h3 style="color: #00000;">ACTVATION CODE:{VAR:order.order_token}</h3>
<h4 style="color: #2e6c80;">Click the <a href=" app.tapatour.eu/ " target="_blank"><span style="background-color: #2b2301; color: #fff; display: inline-block; padding: 3px 10px; font-weight: bold; border-radius: 5px;">Activate</span></a> button to start the tour.</h4>
</p>

as you can see from image attached ...
in the backend it's working fine but not in the email confirm...
I have a doubt that I edited the wrong email :(

Attachments:

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

  • Posts: 83905
  • Thank you received: 13581
  • MODERATOR
3 days 4 hours ago #367401

Hi,

It could indeed be that you're not editing the correct email.
Check in the Customers>Emails history menu. There, you can see all the emails generated by HikaShop (both normal ones and test ones). You can see the "type" of each email, which will tell you which email you need to edit in the System>Emails menu.

Also, it seems you want to change the "order status notification" email.
Note that when you edit this email, you have extra "per status override" buttons on the interface. This way, you can customize the email differently for different statuses.
If you have a status override for the "confirmed" status for the HTML section, the status override will take priority over the HTML section of the main area of the order status notification email.
So it could be that you previously made a customization of the HTML section for that status, and now that you're making a change in the main HTML section, you don't see the changes because of the HTML section for that status is being used.
And when you use the preview button, it's not exactly the same process used to generate the email (because the status of the order is not really being changed) so you don't see the problem there.
Note that this is just a potentiality. I'm not saying that this is the problem you have here.

The following user(s) said Thank You: TconZero

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

  • Posts: 3
  • Thank you received: 0
3 days 2 hours ago #367408

ok, perfect NIkolas...
now works perfectly.
i was actually editing the wrong email (lol!) :)
sorry if i'm wasting your time but i'm just now starting to understand how it works.
Anyway yes, I would like to edit the confirmation email of the successful (paid) order where insert the {VAR:order.order_token} and the instructions that then the customer will use in the progressive webApp to activate the tour/service...
not if I can, but I take the opportunity to ask you another thing:
this order confirmation email I will have to send it in multiple languages, is that possible in your opinion?
if i create constants in the language file and leaving {VAR:order.order_token} as the only common thing?
as always, thank you in advance for your valuable help !
Luca

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

  • Posts: 83905
  • Thank you received: 13581
  • MODERATOR
2 days 16 hours ago #367411

Hi,

No worries.
If you want your text to be in different languages, like the rest of the email, then you need to add a translation in the override file by edit the languages under the Languages tab of the HikaShop configuration. Then, edit the email, and in the "preload" section, you'll need to add a code line like:

'XXX' => JText::_('XXX'),
after the line:
'BILLING_ADDRESS' => JText::_('HIKASHOP_BILLING_ADDRESS'),
where XXX is the translation key you've used to add your translation to the override file.
Then, in your email, you can use {TXT:XXX} and HikaShop will replace it by your translated text automatically when generating the email.

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

Time to create page: 0.089 seconds
Powered by Kunena Forum