neelix71 Posted July 31, 2015 Share Posted July 31, 2015 Hi Guys, Does anybody have any ideas on how I could finish this code? Its a calc that I have added to the "productconfig.tpl" works well and does the calc that I'm after, but I've run in to a problem. What I'm after is when a client chooses the Main product they can also choose an addon product that they can pay off weekly, the weekly amount has been calculated by the due amount / weeks until due due a.k.a why I made the calc. Similar to a "product addon" in WHMCS but can be a random amount, but I would like it to show in the cart the same as an addon would. Appreciate any of your thoughts and tricks, Thanks in advance. {literal} <script> function computeAmount(){ var amount = document.getElementById('amount').value; var weeks = document.getElementById('weeks').value; var payment = (amount / weeks).toFixed(2); payment = payment.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); document.getElementById('payment').innerHTML = "Weekly Amount = $"+payment; } </script> <p>Amount Due: $<input id="amount" type="number" min="1" max="1000000" onchange="computeAmount()"></p> <p>Weeks Until Due Date: <input id="weeks" type="number" min="1" max="52" value="1" step="1" onchange="computeAmount()"></p> <h2 id="payment"></h2> {/literal} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.