wannaspeed Posted April 15, 2019 Share Posted April 15, 2019 Hi, Trying to add a page with a custom javascript calculator. I did it about 6 years ago in prestashop but completely forgot how it's done. I think I need to create a Js page.... anyway I did what I'm trying to do in a demo Abante cart install as can be seen here http://my.abantecart.com/abc_2995509/index.php?rt=product/category&path=71_72 it was easy in Abante just paste the HTML code along with the javascript in the page I wanted. But it doesnt seem prestashop allows direct javascript in the page content section. Link to comment Share on other sites More sharing options...
wannaspeed Posted April 15, 2019 Author Share Posted April 15, 2019 maybe this will do as I want? https://mypresta.eu/prestashop-17/extend-text-editor-in-new-presta.html Link to comment Share on other sites More sharing options...
wannaspeed Posted April 15, 2019 Author Share Posted April 15, 2019 1 hour ago, wannaspeed said: maybe this will do as I want? https://mypresta.eu/prestashop-17/extend-text-editor-in-new-presta.html Well I added this but it's not allowing what I want either. Says content field invalid. <header> <script language="JavaScript"> <!-- var standardPressure = 43.5; var convertCCMINtoLBSHR = 0.095; var convertLBSHRtoGALHR = 0.167; var convertLBSHRtoLHR = 0.63; function recalculate() { var theForm = document.fuelCalcsForm; var injSizeAdjusted = getInjectorSizeTotal() * getMaxDutyCycle() * getFuelPressureAdjustment(); theForm.flywheelHP.value = Math.round(injSizeAdjusted / getBSFC()); theForm.wheelHP.value = Math.round((1-getDrivetrainLosses()) * theForm.flywheelHP.value); theForm.fuelPumpFlow.value = Math.round(injSizeAdjusted * convertLBSHRtoGALHR); theForm.fuelPumpFlowL.value = Math.round(injSizeAdjusted * convertLBSHRtoLHR); theForm.fuelPumpFlowLbs.value = Math.round(injSizeAdjusted); theForm.fuelPumpPressure.value = Math.round(getFuelPressure()) + Math.round(theForm.boost.value) + Math.round(getPressureDrop()); } function getBSFC() { var theForm = document.fuelCalcsForm; BSFC_value = theForm.BSFC.options[theForm.BSFC.selectedIndex].value; if (BSFC_value != "other") { theForm.otherBSFC.value = ""; return BSFC_value; } // must be other, return other value return theForm.otherBSFC.value; } function getFuelPressure() { var theForm = document.fuelCalcsForm; fuelPressure_value = theForm.fuelPressure.options[theForm.fuelPressure.selectedIndex].value; if (fuelPressure_value != "other") { theForm.otherFuelPressure.value = ""; return fuelPressure_value; } // must be other, return other value return theForm.otherFuelPressure.value; } function getInjectorSizeTotal() { var theForm = document.fuelCalcsForm; var totalSize = 0; // injector size 1 if (theForm.injectorSize1.value != '' && theForm.injectorSize1Lbs.value == '') { theForm.injectorSize1Lbs.value = Math.round(theForm.injectorSize1.value * convertCCMINtoLBSHR); } else if (theForm.injectorSize1.value == '' && theForm.injectorSize1Lbs.value != '') { theForm.injectorSize1.value = Math.round(theForm.injectorSize1Lbs.value / convertCCMINtoLBSHR); } var count1 = theForm.injectorCount1.options[theForm.injectorCount1.selectedIndex].value; if (count1 != 0 && theForm.injectorSize1Lbs.value != '') { totalSize += (count1 * theForm.injectorSize1Lbs.value); } // injector size 2 if (theForm.injectorSize2.value != '' && theForm.injectorSize2Lbs.value == '') { theForm.injectorSize2Lbs.value = Math.round(theForm.injectorSize2.value * convertCCMINtoLBSHR); } else if (theForm.injectorSize2.value == '' && theForm.injectorSize2Lbs.value != '') { theForm.injectorSize2.value = Math.round(theForm.injectorSize2Lbs.value / convertCCMINtoLBSHR); } var count2 = theForm.injectorCount2.options[theForm.injectorCount2.selectedIndex].value; if (count2 != 0 && theForm.injectorSize2Lbs.value != '') { totalSize += (count2 * theForm.injectorSize2Lbs.value); } // injector size 3 if (theForm.injectorSize3.value != '' && theForm.injectorSize3Lbs.value == '') { theForm.injectorSize3Lbs.value = Math.round(theForm.injectorSize3.value * convertCCMINtoLBSHR); } else if (theForm.injectorSize3.value == '' && theForm.injectorSize3Lbs.value != '') { theForm.injectorSize3.value = Math.round(theForm.injectorSize3Lbs.value / convertCCMINtoLBSHR); } var count3 = theForm.injectorCount3.options[theForm.injectorCount3.selectedIndex].value; if (count3 != 0 && theForm.injectorSize3Lbs.value != '') { totalSize += (count3 * theForm.injectorSize3Lbs.value); } return totalSize; } function getFuelPressureAdjustment() { var theForm = document.fuelCalcsForm; return Math.sqrt(getFuelPressure() / standardPressure); } function getDrivetrainLosses() { var theForm = document.fuelCalcsForm; drivetrainLosses_value = theForm.drivetrainLosses.options[theForm.drivetrainLosses.selectedIndex].value; if (drivetrainLosses_value != "other") { theForm.otherDrivetrainLosses.value = ""; return drivetrainLosses_value; } // must be other, return other value return theForm.otherDrivetrainLosses.value / 100; } function getPressureDrop() { var theForm = document.fuelCalcsForm; pressureDrop_value = theForm.pressureDrop.options[theForm.pressureDrop.selectedIndex].value; if (pressureDrop_value != "other") { theForm.otherPressureDrop.value = ""; return pressureDrop_value; } // must be other, return other value return theForm.otherPressureDrop.value; } function getMaxDutyCycle() { var theForm = document.fuelCalcsForm; maxDutyCycle_value = theForm.maxDutyCycle.options[theForm.maxDutyCycle.selectedIndex].value; if (maxDutyCycle_value != "other") { theForm.otherMaxDutyCycle.value = ""; return maxDutyCycle_value; } // must be other, return other value return theForm.otherMaxDutyCycle.value / 100; } // --> </script> </header> <meta name="Microsoft Border" content="tb, default"> </head> <script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script><script type="text/javascript">var pageTracker = _gat._getTracker("UA-5668093-1");pageTracker._trackPageview();</script> </style> </head> <body class="oneColLiqCtrHdr"> <div id="container"> <div id="header"> <h1> </h1> <!-- end #header --></div> <div id="mainContent"> <body onLoad="recalculate()"> <!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td> </td></tr><!--msnavigation--></table><!--msnavigation--><table dir="ltr" border="0" cellpadding="0" cellspacing="0" width="100%"><tr><!--msnavigation--><td valign="top"> <form method="POST" name="fuelCalcsForm" onSubmit="recalculate()"> <table border="1" cellpadding="2"> <tr> <th valign="top" align="left" bgcolor="#000000" colspan="3"> <table border="1" cellpadding="2"> <tr> <th valign="top" align="left" bgcolor="#000000" colspan="3"> <h2><font color="#FF0000">How Much Horsepower Will Your Fuel System Support?</font></h2> </th> </tr> <tr> <th valign="top" align="left" bgcolor="#808080"><font color="#FFFFFF">BSFC:<br /> <font size="1">(input)</font></font></th> <td valign="top" bgcolor="#C0C0C0"><select size="1" name="BSFC" onChange="recalculate()"> <option value="0.50">NA Piston (0.50)</option> <option value="0.55">NA Rotary (0.55)</option> <option value="0.60">Turbo Piston (0.60)</option> <option value="0.60">Turbo Rotary Extreme Tune (0.60)</option> <option value="0.62">Tuned Turbo Rotary (0.62)</option> <option selected value="0.64">Stock Turbo Rotary (0.64)</option> <option value="other">Other:</option> </select> <input type="text" name="otherBSFC" size="5" onChange="BSFC.selectedIndex = 6; recalculate()" /> <b>HP*lb/hr</b></td> <td valign="top" bgcolor="#C0C0C0">This is your Brake Specific Fuel Consumption. Choose between NA/Turbo and Piston/Rotary. Most turbo rotaries will use 0.62. You may also designate your own value.</td> </tr> <tr> <th valign="top" align="left" bgcolor="#808080"><font color="#FFFFFF">Fuel Pressure:<br /> <font size="1">(input)</font></font></th> <td valign="top" bgcolor="#C0C0C0"><select size="1" name="fuelPressure" onChange="recalculate()"> <option selected value="40">Stock 93-95 RX-7 (40 psi)</option> <option value="43.5">"Standard" Pressure (43.5 psi)</option> <option value="other">Other:</option> </select> <input type="text" name="otherFuelPressure" size="5" onChange="fuelPressure.selectedIndex = 2; recalculate()" /> <b>psi</b></td> <td valign="top" bgcolor="#C0C0C0">This is your base fuel pressure measured at the FPR or fuel rail. <strong>(No vacuum or boost)</strong></td> </tr> <tr> <th valign="top" align="left" bgcolor="#808080"><font color="#FFFFFF">Fuel Injectors:<br /> <font size="1">(input)</font></font></th> <td valign="top" bgcolor="#C0C0C0"><table border="0" cellpadding="0" cellspacing="10"> <tr> <td align="center"><b>Bank</b></td> <td align="center"><b>#</b></td> <td align="center"><b>cc/min</b></td> <td align="center"></td> <td align="center"><b>lbs/hr</b></td> </tr> <tr> <td align="center">1</td> <td align="center"><select size="1" name="injectorCount1" onChange="recalculate()"> <option value="0">None</option> <option value="1">1</option> <option selected value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td> <td align="center"><input type="text" name="injectorSize1" size="6" value="550" onChange="injectorSize1Lbs.value = ''; recalculate()" /></td> <td align="center">or</td> <td align="center"><input type="text" name="injectorSize1Lbs" size="6" value="" onChange="injectorSize1.value = ''; recalculate()" /></td> </tr> <tr> <td align="center">2</td> <td align="center"><select size="1" name="injectorCount2" onChange="recalculate()"> <option value="0">None</option> <option value="1">1</option> <option selected value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td> <td align="center"><input type="text" name="injectorSize2" size="6" value="850" onChange="injectorSize2Lbs.value = ''; recalculate()" /></td> <td align="center">or</td> <td align="center"><input type="text" name="injectorSize2Lbs" size="6" value="" onChange="injectorSize2.value = ''; recalculate()" /></td> </tr> <tr> <td align="center">3</td> <td align="center"><select size="1" name="injectorCount3" onChange="recalculate()"> <option selected value="0">None</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td> <td align="center"><input type="text" name="injectorSize3" size="6" onChange="injectorSize3Lbs.value = ''; recalculate()" /></td> <td align="center">or</td> <td align="center"><input type="text" name="injectorSize3Lbs" size="6" onChange="injectorSize3.value = ''; recalculate()" /></td> </tr> </table></td> <td valign="top" bgcolor="#C0C0C0"><p>Input how many injectors you have, and how much fuel they flow at 43.5 psi (standard pressure) Enter values in <b>cc/min</b> or <b>lbs/hr</b>.</p></td> </tr> <tr> <th valign="top" align="left" bgcolor="#808080"><font color="#FFFFFF">Max Duty Cycle:<br /> <font size="1">(input)</font></font></th> <td valign="top" bgcolor="#C0C0C0"><select size="1" name="maxDutyCycle" onChange="recalculate()"> <option selected value="0.63">Stock 93-95 RX-7 ECU (63%)</option> <option value="0.80">Recommended Maximum (80%)</option> <option value="0.85">The Controllable Limit (85%)</option> <option value="1">Over 85% (effectively 100%)</option> <option value="other">Other:</option> </select> <input type="text" name="otherMaxDutyCycle" size="5" onChange="maxDutyCycle.selectedIndex = 4; recalculate()" /> <b>%</b></td> <td valign="top" bgcolor="#C0C0C0">This is the maximum duty cycle that the injectors will see. The stock 3rd gen RX-7 ECU maxes out around 63%. The recommended maximum value for programmable ECU's is 85%. Anything above that can result in overheating and cause damage to the injector.</td> </tr> <tr> <th valign="top" align="left" bgcolor="#808080"><font color="#FFFFFF">Drivetrain Losses:<br /> <font size="1">(input)</font></font></th> <td valign="top" bgcolor="#C0C0C0"><select size="1" name="drivetrainLosses" onChange="recalculate()"> <option selected value="0.15">RWD Manual (15%)</option> <option value="0.20">RWD Automatic (20%)</option> <option value="other">Other:</option> </select> <input type="text" name="otherDrivetrainLosses" size="5" onChange="drivetrainLosses.selectedIndex = 2; recalculate()" /> <b>%</b></td> <td valign="top" bgcolor="#C0C0C0">This is an approximation of the power lost in the transmission, differential, etc. Generally loss is between 15-20%</td> </tr> <tr> <th valign="top" align="left" bgcolor="#FF0000"><font color="#FFFFFF">Flywheel HP:<br /> <font size="1">(output)</font></font></th> <td valign="top" bgcolor="#E77471"><b> <input type="text" name="flywheelHP" size="4" onChange="recalculate()" /> HP</b></td> <td valign="top" bgcolor="#E77471">With the above components, your fuel system should be capable of providing enough fuel for this amount of flywheel HP. This is comparable to manufacturers' HP ratings.</td> </tr> <tr> <th valign="top" align="left" bgcolor="#FF0000"><font color="#FFFFFF">Wheel HP:<br /> <font size="1">(output)</font></font></th> <td valign="top" bgcolor="#E77471"><b> <input type="text" name="wheelHP" size="4" onChange="recalculate()" /> WHP</b></td> <td valign="top" bgcolor="#E77471">With the above components, your fuel system should supply enough fuel for this amount of HP at the wheels. This is the power that is measured on a chassis dynamometer.</td> </tr> <tr> <th valign="top" align="left" bgcolor="#000000" colspan="3"> <h3><font color="#FFFFFF">What Size Fuel Pump Do you require?</font></h3> </th> </tr> <tr> <th valign="top" align="left" bgcolor="#C8B560"><font color="#FFFFFF">Boost Pressure:<br /> <font size="1">(input)</font></font></th> <td valign="top" bgcolor="#FFE87C"><input type="text" name="boost" size="5" value="10" onChange="recalculate()" /> <b>psi</b></td> <td valign="top" bgcolor="#FFE87C">For normally-aspirated engines, enter zero. For turbocharged engines enter your max boost pressure</td> </tr> <tr> <th valign="top" align="left" bgcolor="#C8B560"><font color="#FFFFFF">Fuel System Pressure Drop:<br /> <font size="1">(input)</font></font></th> <td valign="top" bgcolor="#FFE87C"><select size="1" name="pressureDrop" onChange="recalculate()"> <option value="10">10 psi</option> <option value="15" selected>15 psi</option> <option value="20">20 psi</option> <option value="other">Other:</option> </select> <input type="text" name="otherPressureDrop" size="5" onChange="pressureDrop.selectedIndex = 3; recalculate()" /> <b>psi</b></td> <td valign="top" bgcolor="#FFE87C">All fuel systems will have a pressure drop from the pump to the rails, due to the lines, filter and other restrictive fuel system components. Enter this value here, if unknown use the default 15 psi.</td> </tr> <tr> <th valign="top" align="left" bgcolor="#FF0000"><font color="#FFFFFF">Fuel Pump Requirements:<br /> <font size="1">(output)</font></font></th> <td valign="top" bgcolor="#E77471">You need a pump that will flow: <table border="0" cellpadding="0" cellspacing="10"> <tr> <td><input type="text" name="fuelPumpFlow" size="4" onChange="recalculate()" /> <b>gal/hr</b> </td> <td></td> </tr> <tr> <td><input type="text" name="fuelPumpFlowL" size="4" onChange="recalculate()" /> <b>L/hr</b> </td> <td> at <input type="text" name="fuelPumpPressure" size="5" onChange="recalculate()" /> <b>psi</b></td> </tr> <tr> <td><input type="text" name="fuelPumpFlowLbs" size="4" onChange="recalculate()" /> <b>lbs/hr</b> </td> <td></td> </tr> </table></td> <td valign="top" bgcolor="#E77471">Based on the above given parameters, you will need a fuel pump with these minimum requirements. </td> </tr> </table> <h1> </h1> <form method="POST" name="fuelCalcsForm" onSubmit="recalculate()"> </form> <p> </p> <p align="center"><!--webbot bot="Navigation" S-Type="siblings" S-Orientation="horizontal" S-Rendering="text" B-Include-Home="FALSE" B-Include-Up="FALSE" U-Page S-Target startspan --><!--webbot bot="Navigation" endspan i-checksum="18290" --><!--msnavigation--></td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr> <td> <p align="center"><font color ="black">Special Thanks to <a href="http://www.maxcooper.com">Maxcooper</a> for letting me use his Fuel calculator script</font> 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