Making a secret coded give a producrt a special offer price (tested with 6.1.2) In the following our secret code is "xyzzy" (without the quotes). Put the following code into actiniccore.js (at the very bottom):- var secretcode = 'xyzzy'; // change this to suit your needs. function formfield(fname){ // look through all forms 'till one containing field "fname" var df = document.forms; // simplified version - only return object fname var i = df.length - 1; for ( var j = 0; j <= i; j++ ) { var k = df[j].length - 1; for ( var l = 0; l <= k; l++ ) { if ( df[j].elements[l].name == (fname) ) { return df[j].elements[l]; } } } alert('Cannot find field ' + fname); // shouldn't happen... return false; } function secretcodecheck(submitimage, prodref){ secretvalue = formfield('SC_' + prodref).value; // the value from out visible full price product if ( secretvalue != secretcode ) secretvalue = ''; submitimage.name = prodref + secretvalue; // alter the submit images name to match our invisible product formfield('Q_' + prodref).name = 'Q_' + prodref + secretvalue; // alter the invisible quantity name to match our displayed product return true; } Save the following code as SecretCode_ProductLine.html This is a standard product template with the NETQUOTEVAR:ADDTOCARTBUTTON replaced by a code field, a custom submit button with some javascript on the button click. NETQUOTEVAR:INCLUDE Act_ProductSeparator.html NETQUOTEVAR:ENDSEPARATOR NETQUOTEVAR:PRODUCTFORMBEGIN NETQUOTEVAR:TEMPLATEBEGINXML NETQUOTEVAR:PRODUCTIMAGE NETQUOTEVAR:PRODUCTNAME NETQUOTEVAR:PRODUCTREF
NETQUOTEVAR:PRODUCTDESCRIPTION NETQUOTEVAR:EXTINFOLINK
NETQUOTEVAR:EXTINFOBUTTON
NETQUOTEVAR:PRODUCTBEGINLINKNETQUOTEVAR:PRODUCTLINKTEXTNETQUOTEVAR:PRODUCTENDLINK NETQUOTEVAR:PRICEEXPLANATION
NETQUOTEVAR:PRODUCTPRICE NETQUOTEVAR:OTHERINFOPROMPT NETQUOTEVAR:DATEPROMPT NETQUOTEVAR:CARTERRORXMLNETQUOTEVAR:PRODUCTQUANTITY
Secret discount code
NETQUOTEVAR:TEMPLATEENDXML NETQUOTEVAR:PRODUCTFORMEND NETQUOTEVAR:NEXT Save the following code as Invisible_ProductLine.html This is a standard product template with EVERYTHING commented out so the product is invisible. NETQUOTEVAR:ENDSEPARATOR NETQUOTEVAR:NEXT Go into Actinic and turn off "Auto Generate Product References" in View / Business Settings / Options. That's all the setup done. Now for each discounted product:- Now create your usual product at the full price. Use SecretCode_ProductLine.html as it's template. Set its product reference to (e.g.) ABC101. Duplicate that product. Set the price to be your discounted one. Use Invisible_ProductLine.html as it's template. Set its product reference to be the same as the one above but with the secret code added (e.g.) ABC101xyzzy. The customer will only see the usual full priced product with an additional secret code input field. If they enter the correct code then the form sumnmission will be altered to select the invisible discounted poroduct. If the wrong (or no code) is entered then the full priced product is added as usual.