Jump to content

[SOLVED] Variables in mail file not replaced


Kicsihun

Recommended Posts

Hello everyone,

 

I am working on a module to send various informations to customers.

 

The variables in the mail file {shop_name}, {shop_url} etc. are not replaced.

 

Other emails, like the contact form are correct.

Your help is appreciated.

Link to comment
Share on other sites

 

The variables in the mail file {shop_name}, {shop_url} etc. are not replaced.

 

 

{shop_name}, {shop_url}

 

in what way are they not replaced? These should show what you have defined in your back office. Are you trying to change them to something else?

 

more info please

Link to comment
Share on other sites

{shop_name}, {shop_url}

 

in what way are they not replaced? These should show what you have defined in your back office. Are you trying to change them to something else?

 

more info please

 

Hello,

 

Thank you for your answer.

 

Those values are defined. I tried sending a mail from the contact form and in that case these variables/strings were replaced with the actual shop name and url.

 

But when I'm trying to use a different mail file (the one created by me), these strings are not replaced. The mail file is sent as it is:

 

 

{shop_name}

 

Hi

Take a look at our new products

{products}

{shop_url} PrestaShop™

Link to comment
Share on other sites

Hello,

 

Thank you for your answer.

 

Those values are defined. I tried sending a mail from the contact form and in that case these variables/strings were replaced with the actual shop name and url.

 

But when I'm trying to use a different mail file (the one created by me), these strings are not replaced. The mail file is sent as it is:

 

 

{shop_name}

 

Hi

Take a look at our new products

{products}

{shop_url} PrestaShop™

curious, I'm no expert in this particular area and looking at contact process I still get a little confused.

 

Please look for your email via the back office-->tools-->translations

select email translations

search for your email

 

do your see your email template?

 

A little tool you could also try is placing {debug} into your new .tpl...just to get what is being passed.

Link to comment
Share on other sites

Hello,

 

I am using 1.2.5 and can't see email translations in Back office.

 

{debug} - works in the case of emails too?

 

-1.2.5...sorry assuming something like 1.3-1.4. which I don't have a copy running of to be of much help I'm afraid

 

I'd try the debug in emails as they are using smarty like variables...

Edited by elpatron (see edit history)
Link to comment
Share on other sites

  • 9 months later...

Sorry to undig this, but i am having a similar problem

 

Some of the e-mails sent to the clients do not assume correctly the variables, so the client received the e-mail like in the image.

 

prestashop%20error.png

 

But this does not happen in all e-mails, some of them have the same variables and are correct....

 

does anyone have an idea how to solve this?

Link to comment
Share on other sites

  • 2 years later...

I will bring back old forum, but im having the same problem with newest 1.6.11 prestashop. variables is not replaced. In final email [the one customers gets] there is no variables in { } but also no replaced values too. Those places where should be translated variable -there is empty. All rest is good, just doesnt replace  variables. Looks like it just deletes them. All url in mails is not working because of href={some variable}" is empty.

Edited by Tommix (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Tommix It would be easier if you add some screen prints of the email translation screens on emails that don't work.

 

All my emails doesnt work. none of them have working URL or logo... looks like all HTML element attribute values are not entered, like SRC for img, HREF for a, and so on..everything who have url :)

Edited by Tommix (see edit history)
Link to comment
Share on other sites

did you search for email links not working, there are a few topics with solution.

if you have {shop_url} and look ate the link: there also should be {shop_url} etc.

if the { } is missing and something like 3d% is in front and at the back, you have to change that.

 

Thanks for replay, i looked at thsi too. There were { } replaced by html encoding, but i made them to be { and } again. And they are replaced, cause in email there is no { or } simbols, there is just EMPTY instead of variables (in mail received). None of the topic helped me. prestashop sadly but very stupidly created.. 

Link to comment
Share on other sites

It is very hard to help you if you don't show the email screenshots of how the email looks in html and a screenshot on how the link looks.

 

For the more technical members: can you help by asking to see the (program)files that are taking care of replacing the variables into links??

Link to comment
Share on other sites

It is very hard to help you if you don't show the email screenshots of how the email looks in html and a screenshot on how the link looks.

 

For the more technical members: can you help by asking to see the (program)files that are taking care of replacing the variables into links??

 

Found problem - this is PrestaShop BUG

When i translate template in Admin panel, many of { } chars becomes html encoded (in real html file) so translation service cant replace variables with value because it looks for { and } not for html ecoded equivalent. 

Also PrestaShop IGNORES core mails if there is theme mail folder, so you have to translate twice, then use some search replaces tools to replace html encoded values to decoded.

Edited by Tommix (see edit history)
Link to comment
Share on other sites

Good you solved it!!

Its not solved, i just found that lazy PrestaShop programmers cant fix this in 3 years. Their trnslation tool in admin panel is usless for emails. it ruins all email tamplates after you click save.

Link to comment
Share on other sites

Well, I'm lost. I did all email, including core mail, with the translation and it is working fine.

 

It's Presta's bug. Lets say i modify 1 template, password reset, and i press Save and Stay -after that ALL templates in my website is broken. { } in href and src is replaced with url encode. MAYBE this is my servers problem, but looks sstrange how server can effect file write.

There is code in AdminTranslationController which encodes html then saves to file.  Maybe it's browser's fault, i use Chrome, but this is so simple task that i blame PS. not servers.

Edited by Tommix (see edit history)
Link to comment
Share on other sites

Yep, it's definately a bug. You can re-produce it like this:

 

Translation -> E-Mails -> "predefined mails" -> "contact_form". Once you edit anything there and save the form, PrestaShop translates the {shop_url} and {shop_logo} to "%7Bshop_url%7D" and "%7Bshop_logo%7D".

 

Changing back to { and } doesnt help because after saving it gets translated back. Please fix.

 

I've notives that after setup of the shop it worked. Bu i cant tell you what chaged it to work anymore. Maybe it is the SEO function. But turning it off doesnt change anything.

 

Update: I found out that after disabling the HTML purifier saving works without the {} getting changed.

Edited by RPetrov (see edit history)
Link to comment
Share on other sites

The only way to avoid problems is just open HTML files (if you use HTML emails) and edit them via some tool. notepad, or any other html hilighting editor. Then upload them back to server and never use backend translator :)

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...