Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Text box in product_info page to shopping cart total


socal_kl

Recommended Posts

the code below is something i developed to help me achieve my goal with the product info page. what im looking to do is to have a text box that counts the charachters that are being typed and adding ($0.25) per letter or character typed. that part i figured out. only thing im having trouble with is implimenting my text box into the total price for osc. i know i can add a text box using the prod. attribs option with the right contribs attached to it, but they dont allow me to calculate per charachter in the text box. is there a way i can place the code below directly into the product_info page and have it add whatever the typed message totals out to be ontop of the total in the shopping cart? please let me know if i need to clarify more.

 

code: <script language="JavaScript" type="text/javascript">

<!--

 

function Calculate(obj,m,opid){

nu=obj.value.replace(/\s/g,'').length;

document.getElementById(opid).value='$'+(nu*m).toFixed(2);

}

//-->

</script>

 

<form name="test">

 

<textarea id="" cols="20" rows="3" maxlength="20" onkeyup="Calculate(this,.25,'op');" onblur="Calculate(this,.25,'op');"></textarea>

<p>

<input id="op" size="10"><br>

</form>

Weather you think you can, or you think you can't. Your right.

Link to comment
Share on other sites

You need to find where it pulls the price out of products_attributes and modify that accordingly to substitute your own price.

Even at a Mensa convention someone is the dumbest person in the room.

Link to comment
Share on other sites

is there a way i can just have the textarea code inside the actual product_info page so that it shows for every product already with out using the prod attributes and putting them on each product individually and then having the total from the charachter count added into the total when add to cart is click?

Weather you think you can, or you think you can't. Your right.

Link to comment
Share on other sites

Its an even bigger pain in the rear when you try to do it outside of the attributes - adjusting the attribute logic to do what you want it to do is easier ...

Even at a Mensa convention someone is the dumbest person in the room.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...