?
Solved

adment my basket total when the user clicks on a option?

Posted on 2005-03-07
2
Medium Priority
?
249 Views
Last Modified: 2013-12-24
i want to adment my basket total when the user clicks on a option, how can this be done? i want somesort of drop down box with delivery options, that onced selected updated the basket total.


  <cfset variables.basketTotal = 0>
<cfoutput query="display_basket">
<cfset variables.basketTotal = variables.basketTotal + display_Basket.line_price>
  <table width="420" border="0">
    <tr valign="top">
      <td width="176"><strong>Product:
      </strong> #item#<br> <strong>Code:</strong>  <strong>Ref:</strong> #ref#</td>
      <td width="99"><strong>Price:</strong><br>
        #LSEuroCurrencyFormat(price)#</td>
      <td width="131"> <a href="remove.cfm?ref=#ref#">Remove Item</a></td>
    </tr>
    <tr valign="top" bgcolor="##CCCCCC">
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><strong>Sub Total:</strong> #basketTotal#</td>
    </tr>
  </table>



</cfoutput>
<table width="420" border="0">
  <tr>
    <td width="39">&nbsp;</td>
    <td width="236">&nbsp;</td>
    <td width="131" bgcolor="#CCCCCC"><b>Total:</b> <cfoutput>#basketTotal#</cfoutput></td>
  </tr>
</table>

0
Comment
Question by:pigmentarts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Expert Comment

by:Plucka
ID: 13475345
Hi pigmentarts,

You can do something like this.

<script language="javaScript">
    function AutoSelect(JumpUrl) {
        window.location.href = JumpUrl;
    }
</script>

Please select your country to calculate the freight cost:
<select name="Country" size="1" onChange="AutoSelect(this.options[Country.selectedIndex].value)">
    <option value="Order.cfm?Country=" selected>Select</option>
    <option value="Order.cfm?Country=Albania">Albania</option>
    <option value="Order.cfm?Country=Algeria">Algeria</option>
    <option value="Order.cfm?Country=American">American</option>
    <option value="Order.cfm?Country=Andorra">Andorra</option>
</select>

When they select an option, a country in this example, it reloads the Order.cfm page with the country parameter so that you can calculate freight / charges etc, etc.

Regards
Plucka
0
 
LVL 8

Accepted Solution

by:
kyle1830 earned 2000 total points
ID: 13476567
you could try this.  Using plucka's example of countries, if you know the value, then just recalculate a value for the form field with the total price.

<script language="JavaScript">
    function ReCalc(){
    var a = document.Test.aTotalPrice.value;
    var b = document.Test.Country.value;
    var c = (a*1+b*1);
    document.Test.bTotalPrice.value = c;
    };
</script>

<form name="Test">
Original Total <input type="Text" name="aTotalPrice" value="10.00">
<br>
New Total <input type="Text" name="bTotalPrice" value="10.00">
<br>
<select name="Country" size="1" onChange="ReCalc(this.options[Country.selectedIndex].value)">
    <option value="0" selected>Select</option>
    <option value="1">Albania</option>
    <option value="2.50">Algeria</option>
    <option value=".75">American</option>
    <option value="1.50">Andorra</option>
</select>
</form>
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question