roro_1 Posted August 13, 2013 Share Posted August 13, 2013 (edited) Use PS 1.5.4.1 . I wanted to insert in a page Google Map without pay for a module. How can I insert javascript code in the html page? Edited August 13, 2013 by roro_1 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 13, 2013 Share Posted August 13, 2013 where you want to insert the map? this is the most important question in this case - everything depends on it Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted August 13, 2013 Share Posted August 13, 2013 (edited) {literal} <----u have to add {literal} to add custom javascript inside .tpl file if its tpl file <script type="text/javascript"> script goes here </script> {/literal} Edited August 13, 2013 by Jiten rash (see edit history) Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted August 13, 2013 Share Posted August 13, 2013 but Google maps are either url or iframe... Link to comment Share on other sites More sharing options...
roro_1 Posted August 13, 2013 Author Share Posted August 13, 2013 where you want to insert the map? this is the most important question in this case - everything depends on it I want insert the map here in preference-->CMS-->where_are but ...I can insert only HTML ...right? http://sdrv.ms/13huB0T Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted August 13, 2013 Share Posted August 13, 2013 ok go to page click on pen sybmol editor will appear then click html there u can Link to comment Share on other sites More sharing options...
vekia Posted August 13, 2013 Share Posted August 13, 2013 jiten i suppose that javascript code in tinymce will not work. even ig you will use "html" editor there. In this case it's necessary to change the tinymce init function. Or just use map in the iframe as you suggested. dear @roro_1 you can easily generate code of own map with this nice and easy in use editor: http://www.map-generator.org/ fill the for there, then click on "generate html" button, you will see box with the code then. copy whole code and insert it to the "html" feature mentioned by jiten above 2 Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted August 14, 2013 Share Posted August 14, 2013 (edited) Google map is better man..u can exactly search the place u looking for..even with lat long. u can retrieve either iframe or html ur wish Edited August 14, 2013 by Jiten rash (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 14, 2013 Share Posted August 14, 2013 jiten have you tried it? this is google maps. It's just simple in use google map iframe generator Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted August 14, 2013 Share Posted August 14, 2013 ya i tried both but on map generator site i face problems location my company sev times Link to comment Share on other sites More sharing options...
vekia Posted August 14, 2013 Share Posted August 14, 2013 just use correct lat & lon values, that's all Link to comment Share on other sites More sharing options...
letrof Posted October 16, 2013 Share Posted October 16, 2013 jiten i suppose that javascript code in tinymce will not work. even ig you will use "html" editor there. In this case it's necessary to change the tinymce init function. Or just use map in the iframe as you suggested. dear @roro_1 you can easily generate code of own map with this nice and easy in use editor: http://www.map-generator.org/ fill the for there, then click on "generate html" button, you will see box with the code then. copy whole code and insert it to the "html" feature mentioned by jiten above I can't use map generator as no it generates javasript code. Any other way to paste a javascript code inside CMS contact? The code from map generator looks now like this: <head> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDtCT40SWIun_nSh_vl2xNQhdHy4dmg84g&sensor=false"></script> <script type="text/javascript" src="http://www.map-generator.org/map/iframejs/80dbb049-b95f-458f-be03-4c34dfe5cdc4?key=AIzaSyDtCT40SWIun_nSh_vl2xNQhdHy4dmg84g&width=350px&height=350px"></script> ... </head> <body> ... <div id ="mapid-80dbb049-b95f-458f-be03-4c34dfe5cdc4"></div> <br /> <a href="http://www.map-generator.org/80dbb049-b95f-458f-be03-4c34dfe5cdc4/large-map.aspx">Powiększ mapę</a> .. </body> Link to comment Share on other sites More sharing options...
vekia Posted October 16, 2013 Share Posted October 16, 2013 hello you need to extend tinymce object, it's described here: tinymce full editor with scripts Link to comment Share on other sites More sharing options...
letrof Posted October 16, 2013 Share Posted October 16, 2013 (edited) hello you need to extend tinymce object, it's described here: tinymce full editor with scripts Yeah, I've been there before but I have no _ADMIN_DIR_/themes/default/template/helpers/form/form.tpl I'm on 1.4.4.1 Edited October 16, 2013 by letrof (see edit history) Link to comment Share on other sites More sharing options...
letrof Posted October 17, 2013 Share Posted October 17, 2013 Is there a way to extend tinymce in 1.4? Link to comment Share on other sites More sharing options...
vekia Posted October 17, 2013 Share Posted October 17, 2013 Yeah, I've been there before but I have no _ADMIN_DIR_/themes/default/template/helpers/form/form.tpl I'm on 1.4.4.1 Is there a way to extend tinymce in 1.4? in class/Validation.php change this: public static function isCleanHtml($html){ $jsEvent = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave'; return (!preg_match('/<[ \t\n]*script/i', $html) && !preg_match('/<?.*('.$jsEvent.')[ \t\n]*=/i', $html) && !preg_match('/.*script\:/i', $html)); } to: public static function isCleanHtml($html){ return $html; } 1 Link to comment Share on other sites More sharing options...
letrof Posted October 17, 2013 Share Posted October 17, 2013 (edited) Thank you! In case someone else is looking - the file is located in classes/validate.php EDIT: After changing the code still can't add javaasript into CMS page Edited October 17, 2013 by letrof (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 17, 2013 Share Posted October 17, 2013 ok, so now it's time to extend tinymce object go to: js/tinymce.inc.js you will see there tinyMCE.init({ mode : "specific_textareas", theme : "advanced", skin:"cirkuit", editor_selector : "rte", editor_deselector : "noEditor", plugins : "safari,pagebreak,style,table,advimage,advlink,inlinepopups,media,contextmenu,paste,fullscreen,xhtmlxtras,preview", // Theme options theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,del,ins,attribs,pagebreak", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : false, content_css : pathCSS+"global.css", document_base_url : ad, width: "600", height: "auto", font_size_style_values : "8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt", elements : "nourlconvert,ajaxfilemanager", file_browser_callback : "ajaxfilemanager", entity_encoding: "raw", convert_urls : false, language : iso }); extend it exactly as i suggested in tutorial you have to add especially this: valid_children: "+body[style|script],pre[script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]", valid_elements : '*[*]' Link to comment Share on other sites More sharing options...
letrof Posted October 17, 2013 Share Posted October 17, 2013 ok, so now it's time to extend tinymce object go to: js/tinymce.inc.js you will see there tinyMCE.init({ mode : "specific_textareas", theme : "advanced", skin:"cirkuit", editor_selector : "rte", editor_deselector : "noEditor", plugins : "safari,pagebreak,style,table,advimage,advlink,inlinepopups,media,contextmenu,paste,fullscreen,xhtmlxtras,preview", // Theme options theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,del,ins,attribs,pagebreak", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : false, content_css : pathCSS+"global.css", document_base_url : ad, width: "600", height: "auto", font_size_style_values : "8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt", elements : "nourlconvert,ajaxfilemanager", file_browser_callback : "ajaxfilemanager", entity_encoding: "raw", convert_urls : false, language : iso }); extend it exactly as i suggested in tutorial you have to add especially this: valid_children: "+body[style|script],pre[script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]", valid_elements : '*[*]' Did that, now more buttons appeared but still pressing HTML button and pasting the code from map generator gives me only a link to the map. It looks like after I press save all the HTML tags dissapears. Maybe I don't understand the way the map should be pasted? Should I do something with the code provided from a map-generator.com or just paste it? 1 Link to comment Share on other sites More sharing options...
vekia Posted October 17, 2013 Share Posted October 17, 2013 seems like this map generator doesnt work well now. if i were you i will try with other generators: for example this one: http://www.embedgooglemap.com/ effect: 1 Link to comment Share on other sites More sharing options...
Faenza Posted November 5, 2013 Share Posted November 5, 2013 Mam nadzieję, że mogę po polsku.Chciałam utworzyć mapę w CMS, tak jak w poście powyżej. Wkleiłam kod z generatora http://www.embedgooglemap.com/ wkleiłam kod z map google z innych map google razem z kluczem API i bez. Wyłączałam przy tym Jave i włączałam. Wklejałam kod w "edycji źródła html" i normalnie w okienko "zawartość strony", niestety za każdym razem mam ten sam błąd: Pole treść (Polski (Polish)) jest nieprawidłowe.Lub pomyślnie się uaktualnia ale nie widać mapy tylko na dole odnośnik do otwarcia jej w nowym oknie. Używam Prestashop 1.5.6.0 gdyby to miało jakieś znaczenie. Da się to zrobić bez grzebania w kodzie? Bo szczerze przyznam, że boję się coś zepsuć i wolę nie grzebać... Bo już grzebałam wcześniej i popsułam Link to comment Share on other sites More sharing options...
vekia Posted November 5, 2013 Share Posted November 5, 2013 hello. we are in english section, please follow forum rules and use language related to forum section. Link to comment Share on other sites More sharing options...
PrestaShark Posted November 5, 2013 Share Posted November 5, 2013 (edited) Mam nadzieję, że mogę po polsku. Chciałam utworzyć mapę w CMS, tak jak w poście powyżej. Wkleiłam kod z generatora http://www.embedgooglemap.com/ wkleiłam kod z map google z innych map google razem z kluczem API i bez. Wyłączałam przy tym Jave i włączałam. Wklejałam kod w "edycji źródła html" i normalnie w okienko "zawartość strony", niestety za każdym razem mam ten sam błąd: Pole treść (Polski (Polish)) jest nieprawidłowe. Lub pomyślnie się uaktualnia ale nie widać mapy tylko na dole odnośnik do otwarcia jej w nowym oknie. Używam Prestashop 1.5.6.0 gdyby to miało jakieś znaczenie. Da się to zrobić bez grzebania w kodzie? Bo szczerze przyznam, że boję się coś zepsuć i wolę nie grzebać... Bo już grzebałam wcześniej i popsułam Hi 1.5.6 version 1) http://www.map-generator.org 2) Paste coordinates 3) Desired size 4) Google Maps API Key 5) Generate 6) In theme/yourtheme/header.tpl put generated code like this <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOURAPIKEY&sensor=false"></script> <script type="text/javascript" src="http://www.map-generator.org/map/iframejs/XXXXX&width=1000px&height=400px"></script> 7) In CMS page paste generated code something like this (in HTML mode) <div id ="mapid-xxxx"></div> 8) I have just done it! 9) This must work! Edited November 5, 2013 by kisweb (see edit history) Link to comment Share on other sites More sharing options...
headscarvesbyciara Posted February 3, 2017 Share Posted February 3, 2017 Not sure of anyone is watching this post anymore. I have tried posting elsewhere and crating new posts but no responses in 3 days so though I would try here. I am using Preastashop 1.6.0.4 and wondered if there is a way to add JSON inside an HTML email template for new_order.htmlThe reason I need to do this is to implement the trustpilot AFS 2.0 . Their new implementation only uses JSON to pass some data to their system via emailI have tried placing the code <script type="application/json+trustpilot"> { "recipientEmail": "{email}", "recipientName": "{firstname}", "referenceId": "{order_name}" } </script> as above, also inside HTML comment tags <!-- --> and inside CDATA tags and inside {literal}{/literal} tags [which Are probabaly only for .tpl files??]The JSON seems to be always stripped out before the email is sent (via swift mailer) I think it is either part of PS core or maybe the result of HTML purifier. I tried disabling HTML purifier from dashboard settings but still no luckAnyway of there is a way to do this i would be most grateful to find out how Link to comment Share on other sites More sharing options...
TurkeyFish Posted October 5, 2018 Share Posted October 5, 2018 I'm having this same kind of issue. I need to insert script tags in the content in the backoffice, but I get 403 errors every time I try, with all modules. I've tried upgrading the tinymce editor as directed for PS 1.6, and it did upgrade it, but it didn't fix the 403 errors. Link to comment Share on other sites More sharing options...
talakaran Posted December 20, 2018 Share Posted December 20, 2018 i want to add code in prestashop 1.7.5 to show in this page قیمت سکه پارسیان is it correct? {literal} <script type="text/javascript" src="https://facenama.com/ppsc?key=a7413b1174e501ec81fdff73cac4d41463175e67"></script> {/literal} Link to comment Share on other sites More sharing options...
bouskdav Posted July 5, 2019 Share Posted July 5, 2019 (edited) On 10/17/2013 at 10:39 AM, vekia said: in class/Validation.php change this: public static function isCleanHtml($html){ $jsEvent = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave'; return (!preg_match('/<[ \t\n]*script/i', $html) && !preg_match('/<?.*('.$jsEvent.')[ \t\n]*=/i', $html) && !preg_match('/.*script\:/i', $html)); } to: public static function isCleanHtml($html){ return $html; } Hi everyone, I just came into similliar situation - and realized that this could be potentially unsafe - because I ('m not a PS developer) dont know at which places the isCleanHtml function is used. So from my point of view there is much more safer solution: - create another function derived from isCleanHtml (possibly isCleanHtmlWithScripts) - you just remove the lines with script matching regex -in /classes/CMS.php on line #64 - definition of content - either remove the 'validate' => 'isCleanHtml' or change it to 'validate' => 'isCleanHtmlWithScripts' Hope it helps. Cheers! Edited July 5, 2019 by bouskdav (see edit history) Link to comment Share on other sites More sharing options...
PS.6thFNGR Posted May 10, 2020 Share Posted May 10, 2020 Hey, got a smiliar Question: I want to add HTML and CSS into a "Pages" Page. But even if HTMLPurifier is deactivated in the Settings, the CSS gets removed from the "Pages" Page Content Source Code when I copy it into it. But same as @bouskdav I am not sure if I should alter PS files and remove the cleaning of css, because I can not determ where else its used. Anyone knows for sure and can say smth about it? Thanks 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