• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Add percentage to total!

Add percentage to total! 13 years 4 months ago #15673

Hi guys, I have one problem!
How can I add a value to a total?
Example:
<script type="text/javascript">
function calculateText()
{
var op1=document.getElementById('field1');
var op2=document.getElementById('field2');
var result=document.getElementById('Total');
 
if(op1.value=="" || op1.value!=parseFloat(op1.value)) op1.value=0;
if(op2.value=="" || op2.value!=parseFloat(op2.value)) op2.value=0;
 
result.value=0;
result.value=parseInt(result.value);
result.value=parseInt(result.value)+parseInt(op1.value)+parseInt(op2.value);
 
if(result.value>0 && result.value<100) result.value=+19.00;
if(result.value>101 && result.value<200) result.value=+35.00;
if(result.value>201 && result.value<300) result.value=+39.00;
if(result.value>301 && result.value<400) result.value=+52.00;
if(result.value>401 && result.value<500) result.value=+52.00;
if(result.value>501 && result.value<1000000000) result.value=[b]+2.50%;[/b]
}
</script>

How can I make it?
Please help ME!

Thank's
The administrator has disabled public write access.

Re: Add percentage to total! 13 years 4 months ago #15678

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
I am not quite sure i understand what you are trying to do here... Are you trying to add a percentage to the calculated value ?

If this is the case, just use:
result.value += "%";
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re: Add percentage to total! 13 years 4 months ago #15681

Yes.
Than the percentage, I would like to add the shipping price.
example:
If the total is from 0 to 100 must be added +(19 €)
If the total is 101 to 200 must be added +(35 €)
If the total is 201 to 300 must be added + (39 €)
If the total is 301 to 400 should be added + (52 €)
If the total is 401 to 500 must be added + (52 €)

But if the price exceeds 500 percent should be added only 2.50%
alexp wrote:
I am not quite sure i understand what you are trying to do here... Are you trying to add a percentage to the calculated value ?

If this is the case, just use:
result.value += "%";
The administrator has disabled public write access.

Re: Add percentage to total! 13 years 4 months ago #15701

:( :(
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!