Poppy381 Posted February 3, 2015 Share Posted February 3, 2015 (edited) Hi, Here is the solution to replace special characters in a TPL translation. For example if you have a special character like (non-breaking space) in your string. In my case I replace white spaces by insecable spaces for prices. {l s='The product price is %s' sprintf='1 000 €.' mod='yourmodulename'} It displays The product price is 1 000 €. Of course it is not what we want. Here is the solution : {capture name='condition'}{l s='The product price is %s' sprintf='1 000 €.' mod='yourmodulename'}mod='crowdfunding'} {/capture} {assign var='condition_1' value=$smarty.capture.condition} {$condition_1|unescape:'html'} Hope you enjoy my solution by using capture smarty function . Edited June 25, 2015 by Poppy381 (see edit history) 1 Link to comment Share on other sites More sharing options...
Poppy381 Posted June 25, 2015 Author Share Posted June 25, 2015 (edited) Unescape is forbidden by Prestashop validator (seek). Anyone has a solution ? Edited June 25, 2015 by Poppy381 (see edit history) Link to comment Share on other sites More sharing options...
J. Danse Posted June 25, 2015 Share Posted June 25, 2015 Hi, As now, yes, unescape is forbiden. :-/ And, as you know, if you escape in html some Smarty vars wich contains html content, you will have some problems in you display. So, you need to do nothing about this var ! But, to pass the validation, you will need to assign your var with the _html suffix and use it like {myvar_html}. You will, of course, have the error in the validator but the manual validation by the team will pass if they can see that 1 Link to comment Share on other sites More sharing options...
Poppy381 Posted June 25, 2015 Author Share Posted June 25, 2015 Thank you very much . I've assigned my variable in controller and template and it works . Link to comment Share on other sites More sharing options...
Poppy381 Posted July 23, 2015 Author Share Posted July 23, 2015 My module has been refused with this method. Here is the comment of a Validator : If you have some HTML content, use a comment on the same line {*HTML CONTENT*} Original message in French : Si vous avez du HTML, préférez utiliser un commentaire sur la même ligne {* HTML CONTENT *}Cordialement,EmmanuelService Client - PrestaShop Addons Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now