PDA

View Full Version : Netquotevar:actinicordertotal


lee.harris
14-Mar-2003, 05:34 PM
Hi All

Probably dead easy if you do Java. Unfortunately, I don't :(

I need to convert NETQUOTEVAR:ACTINICORDERTOTAL in Order4.html into pounds and pence without the currency symbol, i.e. change the base currency unit from pence to pounds, e.g.

if ACTINICORDERTOTAL = 16999

I want a variable that is 169.99 for passing to our affiliate tracking.

Can anyone give me a steer?

Cheers

Lee.

pinbrook_nick
15-Mar-2003, 09:41 AM
Try this:

<script language="JavaScript1.2">
<!--

var act_price = "NETQUOTEVAR:ACTINICORDERTOTAL"
var pounds = act_price.slice(0,-3)
var pennies = act_price.substr(-2,2)

document.write(pounds + "." + pennies)

//-->
</script>

lee.harris
15-Mar-2003, 05:57 PM
Thanks very much Nick.

How could this be used in a function to pass to an affiliate scheme as in the AUG:

<IMG SRC="httpS://www.server.com/log.cgi?amount=NETQUOTEVAR:ACTINICORDERTOTAL&orderid=NETQUOTEVAR:THEORDERNUMBER">

???

TIA

Lee.

pinbrook_nick
15-Mar-2003, 11:05 PM
Have a go with this: :)
<script language="JavaScript1.2">
<!--

var act_price = "NETQUOTEVAR:ACTINICORDERTOTAL"
var pounds = act_price.slice(0,-3)
var pennies = act_price.substr(-2,2)
var affiliate_total = pounds + "." + pennies
document.write("<IMG SRC='httpS://www.server.com/log.cgi?amount=" + affiliate_total + "&orderid=NETQUOTEVAR:THEORDERNUMBER'>")

//-->
</script>

lee.harris
17-Mar-2003, 11:19 AM
Thanks Nick. I was hoping that by presenting what I want to do in the context of the AUG that it would be useful for others. It hopefully is but it's not for me :(

Our affiliate operator takes this code:

<script language="javascript">

merchantID = MERCHANT_SITE_ID
payoutCodes = ""
offlineCode = ""

orderValue = ORDER_VALUE
orderRef = ORDER_REFERENCE

AFProcessSaleV2(merchantID, orderValue, orderRef, payoutCodes, offlineCode)


ORDER_REFERENCE can just be replaced by NETQUOTEVAR:THEORDERNUMBER but I'm struggling to replace ORDER_VALUE with anything meaningful. I simply want to have

orderValue = NETQUOTEVAR:ACTINICORDERTOTAL / 10 but unfortunately, I don't do Java.

I sense that I'm *so* close to this......

pinbrook_nick
17-Mar-2003, 02:28 PM
This is the correct syntax (which you already have!) to divide by 100. (I think it is 100 that you want to divide by, and not 10?)

orderValue = NETQUOTEVAR:ACTINICORDERTOTAL / 100

lee.harris
17-Mar-2003, 02:36 PM
Hi Nick

Spot on on the 10 vs 100.

I tried exactly this (I knew my old Computer Science degree was good for something) yet when I view source on the receipt page, I have:


orderValue = 13999 / 100
orderRef = 17369160000116


for an order with a value of £139.99.

In this section of Act_Order04.html, I have:


orderValue = NETQUOTEVAR:ACTINICORDERTOTAL / 100
orderRef = NETQUOTEVAR:THEORDERNUMBER


I'm well confused.

L.

NormanRouxel
17-Mar-2003, 03:20 PM
Just merge Nick's earlier reply with what your merchant needs:-


<script language="javascript">

// nicks bit
var act_price = "NETQUOTEVAR:ACTINICORDERTOTAL";
var pounds = act_price.slice(0,-3);
var pennies = act_price.substr(-2,2);

// now make into a number
orderValue = (pounds + "." + pennies) - 0;

// and the merchant bit
merchantID = MERCHANT_SITE_ID
payoutCodes = ""
offlineCode = ""
orderRef = NETQUOTEVAR:THEORDERNUMBER

AFProcessSaleV2(merchantID, orderValue, orderRef, payoutCodes, offlineCode)



Norman

lee.harris
17-Mar-2003, 04:24 PM
Now up & running. The solution was the NETQUOTEVAR:ACTINICORDERVALUE/100 but I was just confusing myself looking at the source.

Thanks for all your help Nick & Norman.

You should consider selling these scripts to Actinic ;)