var products = []; products[211] = ["Blue Light Glasses", 59.99, "MJ Health", "Blue light blocking glasses may help reduce eye strain and discomfort that can arise from prolonged exposure to digital screens. By filtering out a portion of the blue light emitted by devices like computers, smartphones, and tablets, these glasses may contribute to a more comfortable viewing experience, especially during evening hours. While individual results can vary, many users report feeling a difference in their eyes after incorporating blue light blocking glasses into their daily routine.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[212] = ["Reading Glasses", 19.99, "MJ Health", "Reading glasses may offer a practical solution for the common experience of needing to hold reading material further away to see it clearly. As a natural part of aging, our eyes can gradually lose their ability to focus up close, and these magnifying lenses may help compensate for this change. By making text and small objects appear larger, reading glasses may provide increased comfort and clarity for everyday tasks such as reading, crafting, or using digital devices, potentially reducing the strain that can come with struggling to see fine print.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[213] = ["Eye Glass Repair Kit", 29.99, "MJ Health", "This comprehensive eyeglass and sunglass repair kit may help you with all your repair needs. It includes a variety of tiny screws, washers, nuts, and silicone nose pads, alongside a precision screwdriver bit set with magnetic tips for easy handling. With multiple types and sizes of nose pads, and all components neatly organized in a small, portable case, this kit may help anyone who wears glasses to easily perform repairs at home or on the go.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[214] = ["Eye Glass Cleaner", 14.99, "MJ Health", "This gentle and effective cleaning spray may help keep your eyeglasses, phone screens, and other delicate glass surfaces pristine. Its balanced formula is designed to remove smudges, dirt, and grime without harming coatings or leaving streaks. Trusted by professionals and made in the USA, this versatile spray may help you achieve a crystal-clear, invisible clean on a variety of devices.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[215] = ["Eye Glass Cloth", 4.99, "MJ Health", "This value pack of six microfiber cleaning cloths may help you keep various surfaces spotless. The ultra-soft material effectively removes fingerprints, dust, and smudges without scratching. Individually packed for convenience, these durable and washable cloths may help maintain clarity on eyeglasses, phone screens, camera lenses, and more, offering a cost-effective and versatile cleaning solution.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[216] = ["Contact Lens Case", 4.99, "MJ Health", "This contact lens case may help simplify your lens care on the go. Its small, travel-sized design and no-leak seal may help keep your lenses secure and your bag dry. Easy to clean and sanitize, with a durable build and soft-grip lids, this case may help you maintain hygiene and convenience for your contact lenses.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[226] = ["Contact Lens Solution", 14.99, "MJ Health", "This preservative-free saline solution may help maximize comfort and clarity for contact lens wearers, especially those with dry and sensitive eyes. Its pH-balanced formula is designed to mimic your eyes' natural tears, making it gentle for daily use and ideal as an insertion solution for scleral lenses.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[227] = ["Safety Glasses", 19.99, "MJ Health", "Safety glasses may help protect your eyes from various hazards in many environments. They are crucial for preventing injuries from flying debris, dust, and chemical splashes, significantly reducing the risk of permanent eye damage. Furthermore, specialized safety glasses may help shield your eyes from harmful light radiation, such as intense UV or infrared light. By wearing appropriate safety eyewear, you may help ensure long-term vision health and overall personal safety during hazardous tasks.", "", "", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "access" ] ; products[217] = ["Keto Gum", 1, "MJ Health", "Keto gum is a sugar-free, aspartame-free chewing gum designed to support a ketogenic lifestyle while offering a healthier alternative to traditional gums and mints. Made with natural ingredients and free from artificial sweeteners, preservatives, and other synthetic additives, it may provide a long-lasting flavor without compromising your diet. Chewing keto gum may help stimulate saliva production, which may reduce plaque buildup and support oral health by preventing cavities.", "", "1 Strip", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[218] = ["ACV Gummies", 79.99, "MJ Health", "The ACV gummies may help you enjoy the benefits of Apple Cider Vinegar in the form of delicious gummies without the foul taste & smell of liquid ACV. For best results it is essential to include a healthy diet & regular exercise in your daily routine along with supplementation.", "", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[219] = ["ACV Gummies", 129.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[220] = ["ACV Gummies", 169.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[221] = ["ACV Gummies", 189.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[222] = ["ACV Gummies", 219.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[223] = ["ACV Gummies", 239.99, "MJ Health", "", "", "6 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[224] = ["Detox", 39.99, "MJ Health", "The Detox supplement is crafted with a blend of gut-friendly fiber extracts designed to support internal cleansing and promote digestive health. When used as part of a balanced lifestyle, it may help improve digestion, enhance nutrient absorption, and contribute to overall wellness. For optimal results, it’s recommended to pair this supplement with a healthy diet and regular exercise. By incorporating these habits into your daily routine, you may maximize the potential benefits of the supplement and maintain a healthier, more balanced system.", "", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[225] = ["Detox", 59.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[228] = ["Blood Formula", 79.99, "MJ Health", "The Blood Formula is formulated with a blend of mulberry & cinnamon extract which may help keep blood sugar levels in the normal range. For best results it is essential to include a healthy diet & regular exercise in your daily routine along with supplementation.", "", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[229] = ["Blood Formula", 129.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[230] = ["Blood Formula", 169.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[231] = ["Blood Formula", 189.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[232] = ["Blood Formula", 219.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[233] = ["Blood Formula", 239.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[234] = ["Omega-3", 39.99, "MJ Health", "Omega 3 dietary supplement crafted especially with specific superfood extract that may help offer overall health & beauty goals when used along with a healthy lifestyle that includes regular exercise & a balanced diet.", "", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[235] = ["Omega-3", 59.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[236] = ["CBD Gummies", 79.99, "MJ Health", "The chewable fast absorption CBD gummies can be taken on-the-go for rapid relief from stress and inflammation. Enriched with pure hemp extracts, the chewable CBD gummies may help the body promptly respond to the therapeutic benefits of cannabidiol. For best results it is essential to include a healthy diet & regular exercise in your daily routine along with supplementation.", "", "1 Bottle", "By placing an order with us you will be charged $ __prc__ + $0.00 for S&H for One Time for __prdqty__ of MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[237] = ["CBD Gummies", 129.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[238] = ["CBD Gummies", 169.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[239] = ["CBD Gummies", 189.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[240] = ["CBD Gummies", 219.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[241] = ["CBD Gummies", 239.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[242] = ["CBD Capsules", 39.99, "MJ Health", "CBD Capsules may help you enjoy the benefits of hemp extract in a safe & effective manner. The supplement is free from THC and its related side effects. Available as a capsule, it can be easily taken with a glass of water. The formula is recommended for use by adults above the age of 18, in consultation with a certified therapist, 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ Health.", "supplement" ] ; products[243] = ["CBD Capsules", 59.99, "MJ 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 MJ Health __prdname__. If you are not completely satisfied with your purchase of MJ Health __prdname__ at any time, please call (844) 676-4284 or email care@buymjhealth.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 MJ 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 QtySub TotalTotal
"; var total = 0; var term_htm =''; 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) { orderedItems[prodId] = quantity; if(prodType == "access"){ var sub_total = round((quantity * products[prodId][1]), 2); }else{ var sub_total = round((products[prodId][1]), 2); } //var sub_total_gbp = round((quantity * products[prodId][6]), 2); total += sub_total; //total_gbp += sub_total_gbp; termTxt = products[prodId][6]; termTxt = replaceAllStr(termTxt, ' __prc__', products[prodId][1].toFixed(2)); //termTxt = replaceAllStr(termTxt, '__pname__', products[prodId][2]); termTxt = replaceAllStr(termTxt, '__prdname__', products[prodId][0]); termTxt = replaceAllStr(termTxt, '__prdqty__', products[prodId][5]); term_htm += '' + termTxt + ''; cartHtml += "
" + "
" + "
" + products[prodId][4] + "

" + products[prodId][0] + " " + products[prodId][5] + "

" + "
" + "" + ""+ "
"+ quantity +"
" + "
$" + sub_total.toFixed(2) + "
" + "
$" + sub_total.toFixed(2) + "
" + "
" } } cartHtml += "
"; cartHtml += "
Order Summary
" +"
" +"" +"
" +"
" +"Continue Shopping Empty Cart " +"
"; cartHtml += "
"; cartHtml += "
" +"
" +"" +"" +"Remove" +"
"; cartHtml += "
"; cartHtml += "
" +"
" +"" +"" +"Remove" +"
"; cartHtml += "
"; if (cartHtml != "") { $("#cartBox").html(cartHtml); $(".trm_1").html(term_htm); } else { $("#cartBox").html(" Loading..."); } var upProdId1 = 219; if(checkItemExists(upProdId1)) { $(".offerBox:eq(0) .sec1-shopnow").text("Added To Order"); $(".offerBox:eq(0) .remove-from-cart").show(); } else { $(".offerBox:eq(0) .sec1-shopnow").text("Yes! Upgrade Now"); $(".offerBox:eq(0) .remove-from-cart").hide(); } var upProdId2 = 220; if(checkItemExists(upProdId2)) { $(".offerBox:eq(1) .sec1-shopnow").text("Added To Order"); $(".offerBox:eq(1) .remove-from-cart").show(); } else { $(".offerBox:eq(1) .sec1-shopnow").text("Yes! Upgrade Now"); $(".offerBox:eq(1) .remove-from-cart").hide(); } return false; } }; var round = function(value, decimals) { return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals); };