Jump to content

All Variables getting HTML escaped in my module in prestashop 1.7 causing module not work


Recommended Posts

Dear Guys,

All Variables getting HTML escaped in my module in prestashop 1.7 causing module not work.Does anyone know how to fix this issue?

 

Even variables that are not supposed to be HTML escaped are getting escaped and getting printed as text.How do I make prestashop aware about this issue?Please advice

  • Like 1
Link to comment
Share on other sites

This is by design. In PrestaShop v1.7, all Smarty variables are automatically escaped, so you no longer need to manually escape them. You can tell Smarty not to escape your variable by adding nofilter like this:

 

{$variable nofilter}

  • Like 5
  • Thanks 2
Link to comment
Share on other sites

  • 8 months later...

This is by design. In PrestaShop v1.7, all Smarty variables are automatically escaped, so you no longer need to manually escape them. You can tell Smarty not to escape your variable by adding nofilter like this:

 

{$variable nofilter}

 

Thank you so much, We were debugging PS 1.7 to the core trying to figure out where it was encoding the XML string that we send to Smarty Fetch.

Odd thing was that it just was happening with DEV MODE ON, LIVE MODE wasn't encoding anything..

 

Anyways, thanks!

Edited by Web VIZO (see edit history)
  • Thanks 1
Link to comment
Share on other sites

  • 8 years later...

In my version of smarty & prestashop writing

{$variable nofilter}

causes the template the crash with

# ps_wirestransfer
<p>
  {l s='If you have questions, comments or concerns, please contact our [1]customer support team[/1].' 
     mod='ps_wiretransfer' 
     sprintf=['[1]' => "<a href='{$contact_url}'>", '[/1]' => '</a>']
  nofilter}
</p>

# error due to nofilter & sprintf used together ?
 too many shorthand attributes in module
Smarty_Internal_TemplateCompilerBase->trigger_template_error('too many shorth...', 14, true)

 

But if I use some other way of writing

<p>
  {l s='If you have questions, comments or concerns, please contact our [1]expert customer support team[/1].' 
     d='Modules.Wirepayment.Shop' 
     sprintf=['[1]' => "<a href='{$contact_url}'>", '[/1]' => '</a>']
  }
</p>

# This works, BUT
# 1) I don't need to add "nofilter" and i see the link
# 2) I don't see an option to translate this sentence for some reason ...

Any ideas how do I get out of this loop ?

Edited by arlevi (see edit history)
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...