1

I'm trying to figure out why a value like ramdom&text, passed as a variable in :

{{htmlescape var=$product.customvariable}}

will appear as random&text(what I want) inside the mail, and actually everywhere, even outside the body...

and as &amp ;text in its title when it's declared that way :

< !--@subject blabla {{htmlescape var=$product.customvariable}}@-->

Any solution will be greatly appreciated :)

Thanks

  • how about using %26 instead of &? – Raks Aug 7 '15 at 13:56
  • I can't modify the input. – Schwipps Aug 7 '15 at 14:23
1

In particular case of the wishlist, the issues seems to be coming out of this little quirk which doesn't seem to care whether the directive is invoked inside subject or body of the email.

To anyone struggling, this is quite an easy workaround: in a given template just add that |raw part at the end of the directive, like in the following:

<!--@subject {{trans "Take a look at %customer_name's Wish List" customer_name=$customerName|raw}} @-->

So in your case try with below code:

< !--@subject blabla {{product.customvariable|raw}}@-->

0

The subject of an email is plain text, not html, so you shouldn't be htmlescaping it.

  • Ok! Sorry,I'm more on the marketing side, so I'm not very familiar with the Magento syntax. I tried to declare the variable with {{var=$product.customvariable}} (without html escape), and the result is the same. I went above, in the code, and it seems the variable is retrieved with : 'customvariable' => $product->getAttributeText('customvariable') May be I can modify something here to get what I want ? – Schwipps Aug 7 '15 at 15:02
  • I think maybe you should check again, clear your caches etc, make sure your using the right template, if var=$product.customvariable is emitting &amp; for & then in the body you would see &amp;amp; because it would be getting escaped again by the htmlescape you have there – Richard Aug 7 '15 at 15:21
  • It's been a while, sorry. I tried to clear all my cache, without any improvement :( I'll try to do a few more tests during the following days. – Schwipps Oct 6 '15 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.