// JavaScript Document //~~~~~~~~~~~~~~~~~~~~~~~~~ Create the shipping button and add to cart button ~~~~~~~~~~~~~~~~~~~~~~~~~ // function shipcost_and_addcart(the_weight, the_item_name, the_item_number, the_item_price) { // the 4 variables below are assume that I want to divide items costing $1 by .55 and // items costing $200 to be divided .8 and everything between on a sliding scale - example // example items costing $50 would be divided by ~ .611558 or $81.76 retail low_cost = 100 high_cost = 10000 mu_low_end = 68 hu_high_end = 85 if (the_item_price == 0) { dscntnd = -1; } if (the_item_price < high_cost) { t_i_p = the_item_price / (((the_item_price - 100) * ((hu_high_end - mu_low_end) / (high_cost - low_cost))) + mu_low_end); } else if (the_item_price > high_cost - 1) { t_i_p = the_item_price / hu_high_end; } // use the next line to adjust all prices up or down by % // t_i_p = t_i_p * .90; // the following if statement added for items with UMRP pricing if (the_weight == 0) { t_i_p = the_item_price / 100; } itmw = the_weight; itmname = the_item_name; itmnumber = the_item_number; itmprice = t_i_p; frmnumber = the_item_number; create_add_to_cart_form(); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function create_add_to_cart_form() { var str = "(error)"; wte = Math.ceil (itmw / 1.0); // nearest pounds21 zip = get_cookie("ziponfile"); if (zip == null) { // If no cookie, return -1 return -1; } var theReferrer = document.cookie.match ( "referreronfile" + '=(.*?)(;|$)' ); // added to track the referrer theReferrer = ( unescape ( theReferrer[1] ) ); SetFedExZ (); // set up FedEx ground shipping zones str = "Shipping cost for FedEx Ground"; for (var i=zn-1; i>=0; i--) { // run table backwards if (zip >= zzip[i]) { // zip value zne = zone[i]; // corresponding zone break; // get out, now } } amt = uzx[zne][wte]; // FedEx charges shipamt = Dollar(amt)*1 + itmprice; if (itmw == 0) { shipamt = itmprice; } shipamt = shipamt.toFixed(2); // if (dscntnd == -1) { shipamt = ' DISCONTINUED'; dscntnd = 0; } // the_form = ''; the_form = the_form + ('
'); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + ('
'); document.getElementById(frmnumber).innerHTML= 'Price: $'+ shipamt +'

' + the_form + view_cart_button(); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function view_cart_button() { the_form = ''; the_form = the_form + ('
'); the_form = the_form + (''); the_form = the_form + (''); the_form = the_form + (' '); the_form = the_form + (''); the_form = the_form + ('
'); return(the_form); }