PDA

View Full Version : Quantity - Any ideas???


stuartn
28-Jan-2003, 10:02 AM
Hi,

I am trying to work a bit of JavaScript on the Receipt page, which gets the NETQUOTEVAR:QUANTITY value so I can use it later on in the Receipt page.

I do the exact same with the product name, and this works 100%, but for some reason the quantity just won't go in.

I am trying something along the lines of:

<SCRIPT>
var ProdName = "NETQUOTEVAR:PRODUCTNAME";
var ProdQuant = "NETQUOTEVAR:QUANTITY";
</SCRIPT>

which i think should work, but for some reason it just ignores the quantity bit. I have tested this quite a number of times, so don't think it is a syntax error.

If anyone has any ideas about why this might be happening, or has another way of getting individual Product Quantities on the Receipt page then please please please could they let me know.:)

Cheers again,

Stuart

cdicken
29-Jan-2003, 09:09 AM
See my answer at
http://community.actinic.com/showthread.php?s=&threadid=401

NormanRouxel
29-Jan-2003, 01:09 PM
I'll try to help but which template of script file are you working on (there are over 150)?

Norman

stuartn
29-Jan-2003, 01:59 PM
Hi Norman,

The HTML file that I am doing this in is order04.html, and basically I have added my own JavaScript into it inorder to get the results I need. The only problem I was having was to get the NETQUOTEVAR:QUANTITY value into a variable. When I stepped through the code though, I can only presume that because the QUANTITY tag returns a hidden type value, this stops me from getting the actual data. Anyway, I have now got round the problem by working out the Quantity of each product sold programmatically - which so far is holding together quite well.

Thanks though,

Stuart

NormanRouxel
29-Jan-2003, 03:39 PM
Glad you've got a solution. The following might help for later.

Some NETQUOTEVARS (like NETQUOTEVAR:COST in Act_ProductPrice.html) return a string of info rather than just the number you want.

You can always extract the bit you need using a regular expression:-

Say 'NETQUOTEVAR:WHATEVER returns something like <input name="xyz" value="123">

Then

var myval = 'NETQUOTEVAR:WHATEVER';
myval = myval.replace(/value="(.*)">/, "$1") - 0;

the first line is happy with the double quotes in the returned valus as it is single quoted.

The second will pick out the numeric bit and convert it to a number.

You can always stick a line like alert(myval); into your code to see what a value contains


Norman