var products = [];
products[214] = ["Ankle Support Brace", 39.99, "Happy Health", "An ankle support brace may help protect the ankle and minimize the risk of injury, especially for those with chronic or acute ankle issues like sprains or plantar fasciitis. The brace may also help relieve pain and swelling while providing stability and support to the ankle joint during activities. Its open heel design allows for a wide range of motion, making it suitable for various indoor and outdoor sports. Made from breathable neoprene, it retains heat, prevents skin irritation, and is designed to be comfortable, flexible, durable, and washable, potentially assisting in the rehabilitation process by limiting excessive movement while allowing for controlled motion.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[215] = ["Back Brace", 59.99, "Happy Health", "A back support brace, featuring metal bionic support rods, may help provide robust support and alleviate symptoms associated with low back pain, a rthritis, muscle aches, herniated discs, and sciatica. For those seeking strong support, particularly for scoliosis, a brace incorporating memory aluminum and spring-loaded strips may help enhance spinal curvature and reduce pain from muscle tension while keeping the torso stable.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[216] = ["Arch Support Insoles", 39.99, "Happy Health", "Arch support insoles may help improve foot and leg alignment, leading to enhanced comfort and potentially easing stress and discomfort associated with conditions like flat feet (pronation), bunions, arthritis. The inclusion of a deep heel cup may help maintain correct foot positioning and protect the heel during high-impact activities like walking or running, while also stabilizing the foot. Crafted from premium EVA material, these insoles may help with shock absorption and reduce foot fatigue, and the fabric covering may help keep your feet cool.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[217] = ["Posture Corrector", 129.99, "Happy Health", "This Back Brace Posture Corrector may help improve your posture by providing long-lasting back support. Crafted from breathable, sturdy, washable, high-quality material, it's designed for durability. The breathable and extra-strong mesh back panel may help keep you comfortable and cool while supporting your spine. Suitable for both men and women, it may help relieve tension and strain in the neck, shoulders, and back.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[218] = ["Neck Brace", 59.99, "Happy Health", "This neck brace is designed to support the jaw and neck, restricting specific neck movements to potentially alleviate pain and pressure in the cervical spine. This restriction may help reduce nerve pressure, improve neck posture, relieve neck pain and fatigue, and stabilize the vertebrae. Crafted with double-layer foam, it may provide gentle yet firm support to maintain the neck's position, counteract gravity, guide cervical spine movement, and offer a sense of security.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[219] = ["Compression Tape ", 19.99, "Happy Health", "This innovative, pre-cut tape may help offer targeted support to specific areas for easy application. By gently lifting the skin, it is believed to potentially improve circulation and reduce pain. Crafted from durable, flexible, and breathable, latex-free materials, it may help provide overall support.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[252] = ["Crutches", 59.99, "Happy Health", "Forearm crutches for adults are designed with comfort and support in mind and may help users move with greater ease. The adjustable height feature may allow for a personalized fit, and the ergonomic grip may provide a comfortable hold. For safety and stability, the non-slip rubber tips may help ensure a secure grip on various surfaces, while the reinforced aluminum frame may offer reliable support. These crutches are constructed from high-quality materials, making them lightweight for easy use and transport, yet durable for long-lasting support. Their user-friendly design may also help with quick, tool-free assembly.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[253] = ["Walking Cane", 39.99, "Happy Health", "This walking cane, constructed from premium aluminum alloy, may help provide sturdy and durable support. Its extra-thick design may allow it to support significant weight, potentially assisting elderly users with walking. The optimized 4-pronged quad base may offer enhanced stability for users, particularly those who are postoperative, while its slightly smaller size may help prevent accidental tripping.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[254] = ["Wheelchair", 239.99, "Happy Health", "This wheelchair, designed for superior durability, may help you confidently navigate diverse terrains with stability. Its precision bearings and large wheels may contribute to smooth movement, allowing you to maneuver through tight spaces and over uneven surfaces with ease. Furthermore, the inclusion of adjustable, swing-away footrests on this folding wheelchair may help simplify transfers, enable convenient storage, and make getting in and out of the chair more accessible.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "access" ] ;
products[223] = ["Keto Gum", 1, "Happy Health", "Keto gum is an aspartame free chewing gum which may provide a healthier alternative to traditional gum, mints, and other keto candy options. With long-lasting flavor, our natural keto gum makes it easy to stay in ketosis for an extended period. No artificial sweeteners, no preservatives, and other artificial ingredients. Chewing sugarless gum stimulates saliva flow, which may help reduce plaque and helps prevent cavities.", "
", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[224] = ["Keto", 79.99, "Happy Health", "The Keto supplement is formulated with BHB salts which may help support natural ketosis, a body function that may help use fat to release energy. It is essential to use the supplement as directed along with a keto-friendly diet and regular exercise for best results.
It is essential to use the supplement as directed along with a keto-friendly diet and regular exercise for best results. ", "", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[225] = ["Keto", 119.88, "Happy Health", "", "
", "2 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[226] = ["Keto", 159.88, "Happy Health", "", "
", "3 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[227] = ["Keto", 179.88, "Happy Health", "", "
", "4 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[228] = ["Keto", 199.88, "Happy Health", "", "
", "5 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[229] = ["Blood Health", 79.99, "Happy Health", "Take a natural approach to blood sugar balance with our mulberry and cinnamon powered supplement. This unique formula may help slow sugar absorption in the gut, potentially leading to healthier blood sugar levels. It may also help improve insulin sensitivity, support glucose metabolism, and may help support overall metabolic wellness.", "
", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[230] = ["Blood Health", 129.99, "Happy Health", "", "
", "2 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[231] = ["Blood Health", 169.99, "Happy Health", "", "
", "3 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[232] = ["Blood Health", 189.99, "Happy Health", "", "
", "4 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[233] = ["Blood Health", 219.99, "Happy Health", "", "
", "5 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[251] = ["Blood Health", 239.99, "Happy Health", "", "
", "6 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[234] = ["Keto Gummies", 79.99, "Happy Health", "Keto Gummies are a nutritional supplement tailored for fitness enthusiasts, designed to help balance your nutrition and support overall health and well-being. Made without fillers, binders, or harmful chemicals, these gummies offer a clean, natural formula. Their convenient gummy form makes daily use simple and enjoyable. These supplements may help support weight management goals, promote the release of energy-efficient ketones, and provide a tasty way to stay on track with your keto lifestyle.", "
", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[235] = ["Keto Gummies", 129.99, "Happy Health", "", "
", "2 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[236] = ["Keto Gummies", 169.99, "Happy Health", "", "
", "3 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[237] = ["Keto Gummies", 189.99, "Happy Health", "", "
", "4 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[238] = ["Keto Gummies", 219.99, "Happy Health", "", "
", "5 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[250] = ["Keto Gummies", 239.99, "Happy Health", "", "
", "6 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[239] = ["Detox", 39.99, "Happy Health", "The Detox supplement is formulated with a blend of gut-loving fiber extracts to support internal cleansing and digestive health. When used consistently, it may help improve digestion, promote nutrient absorption, and enhance overall well-being. For best results, combine this supplement with a balanced diet and regular physical activity. By integrating these practices into your daily routine, you may experience a healthier, more balanced system and maximize the potential benefits of the supplement for long-term wellness.", "
", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
products[240] = ["Detox", 59.99, "Happy Health", "", "
", "2 Bottles", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of Happy Health __prdname__. If you are not completely satisfied with your purchase of Happy Health __prdname__ at any time, please call (866) 505-4917 or email care@happyproductsonline.com, Monday to Friday : 24 Hours | Sat & Sun : 7AM - 11PM (EST). You will receive your package within 2-5 business days of payment via USPS First Class Mail. I agree that my credit card charge will appear as Happy Health.", "supplement" ] ;
console.log(products);
var orderedItems = [];
var orderedTotQty = 0;
var maxQty = 10;
var shipRates = false;
var handling = 0;
var carturl = "cart.php";
// Function to check item exists in cart
var checkItemExists = function(itemId) {
var order = $.cookie('order');
if (!order) {
return false;
} else {
var itemExists = false;
var items = order.split("|");
order = "";
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (order != "") {
order += "|";
}
if (prodId == itemId) {
return true;
}
}
}
return false;
}
//Funtion adds Items to Cart
var addItem = function(itemId, Qty, showFullCart) {
if (typeof showFullCart === "undefined") {
showFullCart = false;
}
orderedTotQty = $.cookie('orderedTotQty');
if (!orderedTotQty) {
orderedTotQty = 0;
}
Qty = parseInt(Qty);
if(Qty > maxQty) {
alert("Maximum " + maxQty + " of this product can be selected in a single order");
return false;
}
var order = $.cookie('order');
if (!order) {
order = itemId + "-" + Qty;
orderedItems[itemId] = Qty;
} else {
var itemExists = false;
var items = order.split("|");
order = "";
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (order != "") {
order += "|";
}
if (prodId == itemId) {
alert("Product already exist in cart");
return false;
if((quantity + Qty) > maxQty) {
alert("Maximum " + maxQty + " of this product can be selected in a single order");
return false;
}
quantity += Qty;
order += prodId + "-" + quantity;
itemExists = true;
} else {
order += prodId + "-" + quantity;
}
orderedItems[prodId] = quantity;
}
if (!itemExists) {
if (order != "") {
order += "|";
}
order += itemId + "-" + Qty;
orderedItems[itemId] = Qty;
}
}
orderedTotQty = parseInt(orderedTotQty);
orderedTotQty += Qty;
$('.cartqty').html(orderedTotQty);
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == carturl) {
showCart(showFullCart, 'add', itemId);
} else {
$(location).attr('href', carturl);
}
};
//Funtion decrements Items to Cart
var removeItem = function(itemId, Qty) {
Qty = parseInt(Qty);
var order = $.cookie('order');
if (!order) {
orderedItems[itemId] = 0;
refreshRow(itemId);
} else {
var items = order.split("|");
order = "";
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (prodId == itemId) {
quantity -= Qty;
if (quantity > 0) {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
}
itemExists = true;
orderedItems[prodId] = quantity;
refreshRow(itemId);
} else {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
orderedItems[prodId] = quantity;
}
}
}
orderedTotQty -= Qty;
$('.cartqty').html(orderedTotQty);
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == carturl) {
showCart(false, 'remove', itemId);
} else {
$(location).attr('href', carturl);
}
};
//Funtion sets Item quantity on the Cart
var setItemQty = function(itemId, Qty) {
Qty = parseInt(Qty);
if(Qty > maxQty || Qty < 0) {
return false;
}
var order = $.cookie('order');
orderedTotQty = 0;
if (!order) {
orderedItems[itemId] = 0;
} else {
var items = order.split("|");
order = "";
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (prodId == itemId) {
quantity = Qty;
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
itemExists = true;
} else {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
}
orderedItems[prodId] = quantity;
orderedTotQty += quantity;
}
}
$('.cartqty').html(orderedTotQty);
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename == carturl) {
showCart(false, 'set', itemId);
} else {
$(location).attr('href', carturl);
}
};
var removeRowItem = function(itemId, showFullCart) {
if (typeof showFullCart === "undefined") {
showFullCart = false;
}
var order = $.cookie('order');
if (!order)
{
orderedTotQty = 0;
} else {
var items = order.split("|");
order = "";
orderedTotQty = 0;
orderedItems = null;
orderedItems = new Array();
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
if (prodId == itemId) {
} else {
if (order != "") {
order += "|";
}
order += prodId + "-" + quantity;
orderedTotQty += quantity;
orderedItems[prodId] = quantity;
}
}
}
if($('#prow-' + itemId).length == 1) {
$('#prow-' + itemId).remove();
}
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
showCart(true, 'removerow', itemId);
};
//Emptying the cart
var emptyCart = function() {
var order = $.cookie('order');
order = "";
orderedTotQty = 0;
orderedItems = null;
orderedItems = new Array();
$.cookie('order', order);
$.cookie('orderedTotQty', orderedTotQty);
if($('[id^="prow-"]').length > 0) {
$('[id^="prow-"]').each(function(){
$(this).remove();
});
}
$('.trm_1').hide();
showCart(false, 'empty');
};
//Displaying the cart items & calculations
function showTotalPrice() {
var cartHtml = "";
var total = 0;
//var total_gbp = 0;
var shipping = 0;
var grand_total = 0;
//var grand_total_gbp = 0;
var sub_total = 0;
//var sub_total_gbp = 0;
var shippingType = '';
//var prodType = '';
var order = $.cookie('order');
orderedTotQty = $.cookie('orderedTotQty');
if($('#shippingCountry').val() == '') {
shippingType = '';
} else if($('#shippingCountry').val() == 'US') {
shippingType = 'US';
} else {
shippingType = 'INTERNATIONAL';
}
if (!order) {
orderedTotQty = 0;
} else {
var items = order.split("|");
if(shipRates) {
shipping = shipRates * 1.0;
}
for (var i = 0; i < items.length; i = i + 1) {
var position = items[i].indexOf("-");
var prodId = items[i].substring(0, position);
var quantity = parseInt(items[i].substring(position + 1));
var prodType = products[prodId][7];
if (prodId != "" && quantity > 0) {
if(prodType == "access"){
sub_total = round((quantity * products[prodId][1]), 2);
}else{
sub_total = round((products[prodId][1]), 2);
}
//sub_total_gbp = round((quantity * products[prodId][6]), 2);
if(prodType == "access"){
total += (quantity * products[prodId][1]);
}else{
total += (products[prodId][1]);
}
//total += (quantity * products[prodId][1]);
//total_gbp +=(quantity * products[prodId][6])
}
}
total = round(total, 2);
//total_gbp = round(total_gbp, 2);
}
var snh = shipping + handling;
//if(shipping == 0) {
// snh = shipping;
//}
console.log(snh);
grand_total = total + snh;
$('#total-price').html('$ ' + total.toFixed(2));
$('#shipping-price').html('$ ' + snh.toFixed(2));
$('#grand-total').html('$ ' + grand_total.toFixed(2));
};
// Refresh row content with updated quantity / price for a product
function refreshRow(pid) {
pid = parseInt(pid);
quantity = orderedItems[pid];
sub_total = round((quantity * products[pid][1]), 2);
$('#prow-' + pid + ' .tot-price').html('$' + sub_total.toFixed(2) + ' USD');
$('#prow-' + pid + ' .qtybox').val(quantity);
$('#prow-' + pid + ' .dispqty').html(quantity);
}
function replaceAllStr(str, find, rstr) {
//return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
//return str.replace(/find/g, '\\$&');
return str.replace(new RegExp(find, "g"), rstr);
}
//Displaying the cart items & calculations
function showCart(showFullCart, act, itm) {
var cartHtml = "";
var order = $.cookie('order');
orderedTotQty = $.cookie('orderedTotQty');
if (!order)
{
orderedTotQty = 0;
if($('[id^="prow-"]').length == 0) {
$("#cartBox").html("
Select Products
  Browse Products"); } showTotalPrice(); return false; } else { var items = order.split("|"); var total = 0; var total_gbp = 0; var shipping = 0; var grand_total = 0; orderedTotQty = parseInt(orderedTotQty); if (typeof showFullCart === "undefined") { return false; } else if(showFullCart == false) { if ((typeof act !== "undefined") && (typeof itm !== "undefined")) { if((act == 'add' || act == 'set' || act == 'remove') && itm > 0) { refreshRow(itm); } else if(act == 'removerow' && itm > 0) { itm = parseInt(itm); } } showTotalPrice(); return false; } orderedItems = null; orderedItems = new Array(); cartHtml += "" + products[prodId][0] + " " + products[prodId][5] + "