elkiff Posted November 25, 2013 Share Posted November 25, 2013 Bonjour, je souhaitais creer une page CMS avec un code javascript mais ca me donne une erreur. Je suis avec la toute dernier version prestashop. Mon code est: <html><head><meta http-equiv="content-type" content="text/html; charset=windows-1252"><title>Calculateur Vape - By EL KIFF</title><script language="JavaScript">function calculate(){ var power1, current1, voltage1, resistance1 power1=parseFloat(document.theForm.power.value) current1=parseFloat(document.theForm.current.value) voltage1=parseFloat(document.theForm.voltage.value) resistance1=parseFloat(document.theForm.resistance.value) if (isNaN(power1)&&isNaN(current1)&&isNaN(voltage1)&&isNaN(resistance1)) convert(00) else if (isNaN(power1)&&isNaN(current1)&&isNaN(voltage1)) convert(1) else if (isNaN(power1)&&isNaN(current1)&&isNaN(resistance1)) convert(1) else if (isNaN(power1)&&isNaN(voltage1)&&isNaN(resistance1)) convert(1) else if (isNaN(current1)&&isNaN(voltage1)&&isNaN(resistance1)) convert(1) else if (isNaN(power1)&&isNaN(current1)) convert(2) else if (isNaN(power1)&&isNaN(voltage1)) convert(3) else if (isNaN(power1)&&isNaN(resistance1)) convert(4) else if (isNaN(current1)&&isNaN(voltage1)) convert(6) else if (isNaN(current1)&&isNaN(resistance1)) convert(7) else if (isNaN(voltage1)&&isNaN(resistance1)) convert(8) else if (isNaN(power1)) convert(5) else if (isNaN(current1)) convert(5) else if (isNaN(voltage1)) convert(5) else if (isNaN(resistance1)) convert(5) else convert(9) }function convert(method){ var power1, current1, voltage1, resistance1 if (method==00){ alert("Entrer seulement deux valeurs" + '\n' + "dans les cases!"); } if (method==1){ alert("Entrer une autre valeur." + '\n' + "Le calculateur a besoin de deux valeurs!"); } if (method==2){ voltage1=parseFloat(document.theForm.voltage.value) resistance1=parseFloat(document.theForm.resistance.value) power1=(voltage1*voltage1)/resistance1 current1=voltage1/resistance1 document.theForm.power.value=power1 document.theForm.current.value=current1 } if (method==3){ current1=parseFloat(document.theForm.current.value) resistance1=parseFloat(document.theForm.resistance.value) power1=current1*current1*resistance1 voltage1=current1*resistance1 document.theForm.power.value=power1 document.theForm.voltage.value=voltage1 } if (method==4){ current1=parseFloat(document.theForm.current.value) voltage1=parseFloat(document.theForm.voltage.value) power1=voltage1*current1 resistance1=voltage1/current1 document.theForm.power.value=power1 document.theForm.resistance.value=resistance1 } if (method==5){ alert("Enlever une valeur." + '\n' + "Seulement deux valeurs doivent" + '\n' + " etre converties !"); } if (method==6){ power1=parseFloat(document.theForm.power.value) resistance1=parseFloat(document.theForm.resistance.value) current1=Math.sqrt(power1/resistance1) voltage1=Math.sqrt(power1*resistance1) document.theForm.current.value=current1 document.theForm.voltage.value=voltage1 } if (method==7){ power1=parseFloat(document.theForm.power.value) voltage1=parseFloat(document.theForm.voltage.value) current1=power1/voltage1 resistance1=(voltage1*voltage1)/power1 document.theForm.current.value=current1 document.theForm.resistance.value=resistance1 } if (method==8){ power1=parseFloat(document.theForm.power.value) current1=parseFloat(document.theForm.current.value) voltage1=power1/current1 resistance1=power1/(current1*current1) document.theForm.voltage.value=voltage1 document.theForm.resistance.value=resistance1 } if (method==9){ alert("Enlever deux valeurs." + '\n' + "Inserer seulement deux valeurs" + '\n' + "pour faire la convertion!"); } } function reset1(){ document.theForm.power.value="" document.theForm.voltage.value="" document.theForm.current.value="" document.theForm.resistance.value="" }</script><style type="text/css">.clear { /* generic container (i.e. div) for floating buttons */ overflow: hidden !important; width: 100% !important;}a.fantasybutton { color: #444 !important; display: block !important; float: left !important; font: normal 12px arial, sans-serif !important; height: 31px !important; width: 109px !important;}a.fantasybutton:active { background-position: bottom right !important; color: #000 !important; outline: none !important; /* hide dotted outline in Firefox */}#mytubem { margin: 0 !important; padding: 0 !important; z-index: 30 !important;}#mytubem li { margin: 0; padding: 0; list-style: none; float: left; font: bold 11px arial}#mytubem div { position: absolute; top: 30px; width: 107px; visibility: hidden; margin: 0; padding: 0; background: #9CC02B; border: 1px solid #4C4C4C !important}#mytubem div a { position: relative !important; display: block !important; margin: 0 !important; padding: 5px 10px !important; width: auto; white-space: nowrap !important; text-align: center !important; text-decoration: none !important; background: #000000 !important; color: #FFFFFF !important; font: 12px arial, sans-serif !important}#mytubem div a:hover { background: rgb(135,10,10) !important; color: #FFFFFF !important}</style></head><body><font face="arial"><center><form name="theForm"><table bgcolor="#b14a78" border="1" cellpadding="1" cellspacing="0"><tbody><tr><td><table border="0" cellpadding="3" cellspacing="0"><tbody><tr><td colspan="3"><font face="arial"><b>Calculateur pour la Vape - By EL KIFF</b><br>Copyright 2013</font></td></tr><tr><td> </td></tr><tr><th><font face="arial">Puissance</font></th><td><input name="power"></td><td><font face="arial">Watts</font></td></tr><tr><th><font face="arial">Voltage</font></th><td><input name="voltage"></td><td><font face="arial">Volts</font></td></tr><tr><th><font face="arial">Courant</font></th><td><input name="current"></td><td><font face="arial">Amps</font></td></tr><tr><th><font face="arial">Résistance</font></th><td><input name="resistance"></td><td><font face="arial">Ohms</font></td></tr><tr><td> </td><td><input value="Calculer" onClick="calculate()" type="button"></td><td><input onClick="reset1()" value="Effacer" type="button"></td></tr><tr><td> </td></tr><tr><td colspan="3"><img src="calculateur/tabl.png" height="370" width="379"></td></tr></tbody></table></td></tr></tbody></table>Entrer seulement deux valeurs pour effectuer un calcul.</form></center></font></body></html> Après avoir mis ce code ca me met cette erreur : [PrestaShopException]Property CMS->content is not validat line 878 in file classes/ObjectModel.php 872. 873. $message = $this->validateField($field, $value, $id_lang);874. if ($message !== true)875. {876. if ($die)877. throw new PrestaShopException($message);878. return $error_return ? $message : false;879. }880. }881. }882. ObjectModelCore->validateFieldsLang - [line 296 - classes/ObjectModel.php] - [0 Argument] ObjectModelCore->getFieldsLang - [line 634 - classes/ObjectModel.php] - [0 Argument] ObjectModelCore->update - [line 75 - classes/CMS.php] - [1 Arguments] CMSCore->update - [line 334 - controllers/admin/AdminCmsController.php] - [0 Argument] AdminCmsControllerCore->postProcess - [line 121 - controllers/admin/AdminCmsContentController.php] - [0 Argument] AdminCmsContentControllerCore->postProcess - [line 158 - classes/controller/Controller.php] - [0 Argument] ControllerCore->run - [line 348 - classes/Dispatcher.php] - [0 Argument] DispatcherCore->dispatch - [line 53 - admin1964/index.php] - [0 Argument] Link to comment Share on other sites More sharing options...
Oron Posted November 26, 2013 Share Posted November 26, 2013 Bonjour Je déplace votre topic dans le forum Développement et adaptation de Prestashop où vous aurez sans doute plus de chance d'une réponse. Link to comment Share on other sites More sharing options...
elkiff Posted November 26, 2013 Author Share Posted November 26, 2013 Ok merci.. j'attends de l'aide ^^ Link to comment Share on other sites More sharing options...
Szed Posted November 26, 2013 Share Posted November 26, 2013 Le plus propre serait soit : De créer votre page HTML a coté du prestashop, et de l'appelez dans une iFrame dans votre page CMS (en n'oubliant pas dans les préférences d'accepter la présence d'iframe). Soit de placer votre CSS et votre JS dans les fichiers de votre thème (dans global.css, et dans une fichier JS adéquat), et de ne mettre que votre HTML dans la page CMS. Link to comment Share on other sites More sharing options...
elkiff Posted November 27, 2013 Author Share Posted November 27, 2013 Si je crée la page html je dois tapper quoi comme code dans la page CMS pour appeler ma page html ? J'aurai préféré la 2eme solution mais je sais pas comment faire pour decouper mon code CSS et JS dans deux fichiers distincts et de les integrer dans l'html dans lapage CMS Link to comment Share on other sites More sharing options...
Szed Posted November 27, 2013 Share Posted November 27, 2013 Par exemple, en partant du principe que vous placez votre page HTML à la racine du site : <iframe src="http://www.votredomaine.com/mapage.html"></iframe> Link to comment Share on other sites More sharing options...
elkiff Posted November 27, 2013 Author Share Posted November 27, 2013 Okla première solution mmarche correctement merci 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