Jump to content

Product Calc connecting to cart


neelix71

Recommended Posts

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}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated