Jump to content

Prestahop 1.7.8.6 - Variables in Emails href links are not resolved { is %7B


Patrick F

Recommended Posts

Hello,
we have a problem when sending emails via the shop system. I hope someone can help me. I found some old threads on this topic, but they always affect all variables, ours specifically only affects HTML links.

The thing is that the variables {url} , {shop_url}, {followup} are not replaced by the real links if they are in a  <a href="{shop_url}" HTML link. They are only filled by the system in the text field behind it.

Example password_query.html

The line in the HTML code looks like this:

<div style="font-family: Open sans, arial, sans-serif; font-size: 14px; line-height: 25px; text-align: left; color: #363a41;" align="left">Zur Best&auml;tigung klicken Sie bitte auf den folgenden Link: <a href="{url}" target="_blank" style="text-decoration: underline; color: #25b9d7; font-weight: 600;" >{url}</a></div>

 

When the customer receives the mail, he only sees the text line, no clickable link. The code of the email looks like this:

<div style=3D"font-family: Open sans, arial, sans-serif; font-size: 14p=
x; line-height: 25px; text-align: left; color: #363a41;" align=3D"left">Zur=
 Best&auml;tigung klicken Sie bitte auf den folgenden Link: <a href=3D"%7Bu=
rl%7D" target=3D"_blank" style=3D"text-decoration: underline; color: #25b9d=
7; font-weight: 600;">https://stang-parts.de/passwort-zuruecksetzen?token=
=3D202agdhet345354dc133d37db6id_customer=3D28&reset_token=3De73e90=
7001453ge8fb44fc8</a></div>

I edited the HTML files with Notepad++ (in UTF8) and uploaded them with WinSCP. There used to be a problem in Prestashop when you edit the mails directly in the system, I found some topics about this.

As you can see, the link is in the text, but not in the href html link, where the curly brackets are converted to %7B and %7D.
This is the case in all emails with all variables in href links, never in the text.
Does somebody has any idea?

I looked in the mail.php but can not find the conversion of {url}, only the other variables like {shop_url}

 

           if ((Context::getContext()->link instanceof Link) === false) {
                Context::getContext()->link = new Link();
            }

            $templateVars['{shop_name}'] = Tools::safeOutput($configuration['PS_SHOP_NAME']);
            $templateVars['{shop_url}'] = Context::getContext()->link->getPageLink(
                'index',
                true,
                $idLang,
                null,
                false,
                $idShop
            );
            $templateVars['{my_account_url}'] = Context::getContext()->link->getPageLink(
                'my-account',
                true,
                $idLang,
                null,
                false,
                $idShop
            );
            $templateVars['{guest_tracking_url}'] = Context::getContext()->link->getPageLink(
                'guest-tracking',
                true,
                $idLang,
                null,
                false,
                $idShop
            );
            $templateVars['{history_url}'] = Context::getContext()->link->getPageLink(
                'history',
                true,
                $idLang,
                null,
                false,
                $idShop
            );
            $templateVars['{order_slip_url}'] = Context::getContext()->link->getPageLink(
                'order-slip',
                true,
                $idLang,
                null,
                false,
                $idShop

 

Perhaps still important, we have a multi-shop system. The main shop is in Polish, the server is in Poland, my shop was copied from the main shop and it is german, it has the same theme and email folder. At first there were some problems with the copy of the master data, we have them all solved, except for the email html link problem.
I suspect a problem with the different CodePages in Polish and German, but again the problem is only in "href" not in the shown text behind it.

I'd be happy for help.

Greeting
Patrick Frank

Link to comment
Share on other sites

It is wierd as it looks correct in the source file. Two things to try/check: 1. Replace the html file by the original prestashop one. 2. Check if any override exits e.g. for Mail.php class

{url} by the way is filled in the PasswordController.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...