insert the order_token into confirmation email

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
3 weeks 6 days 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: 83997
  • Thank you received: 13611
  • MODERATOR
3 weeks 6 days 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: 8
  • Thank you received: 0
  • Hikashop Business
3 weeks 6 days 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: 83997
  • Thank you received: 13611
  • MODERATOR
3 weeks 6 days 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: 8
  • Thank you received: 0
  • Hikashop Business
3 weeks 5 days 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: 83997
  • Thank you received: 13611
  • MODERATOR
3 weeks 5 days 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.

The following user(s) said Thank You: TconZero

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

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
3 weeks 1 day ago #367484

ok perfect!

i've the last question if you can help me again :unsure:

I would like to construct a url string that passes values (e.g.:user email) via GET into the body of the email through a hidden link inside a button.

I tried this way but it doesn't work:

<h4 style="color: #2e6c80;">Perfect, when you're ready to start the tour, click the <a href="https://app.tapatour.eu/index.php?user={VAR:user.user_email}" target="_blank"><span style="background-color: #2b2301; color: #fff; display: inline-block; padding: 3px 10px; font-weight: bold; border-radius: 5px;">START THE TOUR</span></a> button, insert your activation code and start the tour.</h4>
is there any way to do this?

yhanks in advance,

Luca

Last edit: 3 weeks 1 day ago by nicolas.

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

  • Posts: 83997
  • Thank you received: 13611
  • MODERATOR
3 weeks 23 hours ago #367485

Hi,

The problem is that there is no tag {VAR:user.user_email}
The tag you want to use is {VAR:customer.user_email}

Please note that there is a button "list of available tags" just above the HTML area when you edit an email.
This will give you a list of all the tags including this one.

The following user(s) said Thank You: TconZero

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

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
1 day 10 hours ago #367665

thanks again for your valuable advice!
It works perfectly.
However, I noticed a problem during checkout....
If I enter a coupon (100% discount) the cart updates correctly...
but when I go to press "confirm" to finish nothing happens...
even if I press it several times.
I have to do a refresh (F5) of the page and, only after that, it works :(
I attach a screen recording for you to understand better.
What can it depend on?
Can it be solved in some way?
Tnaks again in advance,
Luca

File Attachment:

File Name: screen-cap...-opt.zip
File Size:1,632 KB

Attachments:

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

  • Posts: 83997
  • Thank you received: 13611
  • MODERATOR
1 day 6 hours ago #367666

Hi,

The checkout can be configured in many different ways, and there are many plugins and other things which can interfere.
So it's hard for me to say what the problem is without analyzing the details.
Could you provide the following ?
- a super admin backend access in order to check your settings
- a FTP access if debug is necessary

You can do so via our contact form:
www.hikashop.com/support/contact-us.html

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

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
1 day 6 hours ago #367667

Sure!

I've just provided all credential via contact...

Thanks :)

Luca

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

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
1 day 6 hours ago #367668

try the coupon "TAPAGIOFREE" to check the problem...

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

  • Posts: 83997
  • Thank you received: 13611
  • MODERATOR
1 day 2 hours ago #367670

Hi,

Thanks for the accesses.

The problem is a complex one between the Stripe Connect plugin, the way you configured its payment method, and the fact that you're trying to use a 100% coupon code, and the fact that the payment and the coupon views are on the same step.
This leads to the Stripe Connect's javascript stopping the process to the next step to try to process the credit card fields of the payment method, even though the payment selection area, along with the credit card form has been removed from the page following the use of the coupon code. And since the credit card form is missing, the plugin's javascript can't process anything and thus it doesn't let you move forward.
It requires a full refresh of the page in such a case, so that the javascript of the Stripe Connect plugin is not included anymore and then it lets you proceed.

So, all this means that there are several ways to circumvent the problem:
- don't have the coupon and the payment view on the same step
- configure the Stripe Connect plugin to display the credit card form at the end of the checkout, not during the payment method selection
- configure the PayPal payment method to be the first one. That way the plugin won't add its javascript by default to the page

Now saying that, it's something that still needs to be fixed properly. So I've looked into it and I've made a patch to the checkout / show_block_payment view of HikaShop so that it properly checks whether the payment methods are selectable or not on the page before trying to contact the javascript of the payment plugins. That way, it will allow the checkout to proceed unimpeded in such a case.
I've deleted the view override of that view in your template and added the necessary modifications to that view with a new view override. I've also added the modifications on our end. So for anyone with the issue, updating to HikaShop 6.0.0 or newer will fix the problem.
However, the day you update your template in the future, the view override I've created for your website will likely be overwritten by your template's new version.
Thus this means that you have several things to take into account:
- ideally, you want to report the issue to the template provider so that they can update their template with the new version of the checkout / show_block_payment view file. This will also help others with a similar situation. And if they do it, you won't have to do anything in the future regarding this issue
- Otherwise, after updating the template, and supposing you've updated your HikaShop since then, you'll want to delete the view override of checkout / show_block_payment, so that it will use the default view file, which will contain the modifications.

The following user(s) said Thank You: TconZero

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

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
10 hours 17 minutes ago #367677

Hi Nicolas,
first of all I wanted to congratulate you for the professionalism and timeliness with which you solved the problem!
I am more and more happy that I chose hikashop for my client's project :)
Then, of course, to say thank you again! ;)
Luca.

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

  • Posts: 83997
  • Thank you received: 13611
  • MODERATOR
8 hours 10 minutes ago #367678

Thanks !
If you didn't do it already, please consider leaving a review on the JED:
extensions.joomla.org/extension/hikashop/
Each good review there helps us a lot :)

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

Time to create page: 0.104 seconds
Powered by Kunena Forum