var products = []; products[210] = ["Dry Running T-Shirt", 75, "Diamond Gym Gear", "Created with feminine lines & ultra-soft feel this Dry Fit T-Shirt offers versatile functionality, and is must have for all the fitness enthusiasts out there. Originally crafted for running, the T-Shirt is perfect for crossfit training, gym workouts & even sports. ", "", "Dry Running T-Shirt"]; products[213] = ["Seamless Yoga T-Shirt", 75, "Diamond Gym Gear", "Our yoga designers created this lightweight and feminine product using seamless technology. You'll forget all about it on the mat! A seamless, breathable T-shirt in lightweight, draping fabric with a subtle pattern, perfect length and comfy straight fit: Perfect for learning dynamic yoga!", "", "Seamless Yoga T-Shirt"]; products[223] = ["Golf Polo T-Shirt ", 80, "Diamond Gym Gear", "Crafted specially for golfing enthusiasts, the soft & flexible pique knit provides golfers with essential comfort, allowing for complete range of motion. It is made with a blend of cotton & polyester fabric to wick away moisture on those sunny 18-hole days. ", "", "Golf Polo T-Shirt "]; products[224] = ["Dry-Fit Gym T-Shirt ", 75, "Diamond Gym Gear", "Created for female fitness buffs, this T-shirt provides effective perspiration management and freedom of movement while you workout, run or even do yoga! This comfortable, breathable and feminine T-shirt will quickly be a must have for those summer months, while serving as the perfect base layer for the winters too! ", "", "Dry-Fit Gym T-Shirt "]; products[225] = ["Short Sleeved T-Shirt", 75, "Diamond Gym Gear", "Originally created for mountain walking & trailing, this T-Shirt has become a hot favorite with our female patrons as a must-have outdoor workout garment. The rear collar design protects the back of your neck from the sin & any friction from backpacks etc.", "", "Short Sleeved T-Shirt"]; products[226] = ["Surfing Swimsuit Bottom", 70, "Diamond Gym Gear", "We have designed this swimsuit for beginner surfers surfing in broken waves. These women's swimsuit bottoms with classic styling are perfect for all body shapes; the elasticated edges help them stay in place in the waves. And the cool pattern is also sure to make heads turn too!", "", "Surfing Swimsuit Bottom"]; products[227] = ["Surfing Swim Top", 90, "Diamond Gym Gear", "The swimsuit biking top offers complete coverage & support for the bust in the front. However the open shoulders & back are open for the much needed comfort, style & beach appeal! It comes with adjustable cross straps & removable pads. ", "", "Surfing Swim Top"]; products[228] = ["Long Sleeves Swimsuit", 95, "Diamond Gym Gear", "Perfect for surfing, sea-swimming, & water sports this one-piece long sleeves swimsuit comes with a back zip that stays firmly no matter how large the waves! It is a great product for those really sunny days at the beach or the pool! ", "", "Long Sleeves Swimsuit"]; products[229] = ["Relaxed Running Pants ", 125, "Diamond Gym Gear", "Lightweight, breathable, comfortable - these fluid trousers are perfect for running while also doubling up as loungewear. These pants will win you over with its quick drying, moisture wicking & soft fabric, making it a must have in your running, jogging, workout wardrobe! ", "", "Relaxed Running Pants "]; products[230] = ["Polyester Gym Pants", 125, "Diamond Gym Gear", "The basic straight-cut jogging bottoms we all need for feeling at ease during workouts. An elasticated waistband, zipped pocket and stretchy fabric: these jogging bottoms are just the way we like them. You won't want to ever be without them.", "", "Polyester Gym Pants"]; products[239] = ["Cardio Sports Bra ", 65, "Diamond Gym Gear", "Made for those passionate about their cardio, these uber cool & sexy sports bras are created for low-impact fitness activities. The ultra-soft fabric wicks away perspiration & the design offers great support & coverage - a must have for those intensive sessions! ", "", "Cardio Sports Bra "]; products[240] = ["Yoga Sports Bra ", 65, "Diamond Gym Gear", "This is the must-have long sports bra that supports your bust without compressing it so you can focus on your vinyasas, not your clothing. Are you a fan of hot yoga or Ashtanga? This yoga sports top with removable pads and comfortable straps feels like a second skin. Wear it alone or under a tank top.", "", "Yoga Sports Bra "]; products[245] = [" ", 40.91, "Diamond Gym Gear", "", "", " "]; products[246] = ["", 40.91, "Diamond Gym Gear", "", "", " "]; products[247] = [" ", 40.91, "Diamond Gym Gear", "", "", " "]; products[247] = ["", 40.91, "Diamond Gym Gear", "", "", " "]; products[211] = ["Ventilated Trekking Cap", 38, "Diamond Gym Gear", "Our passionate mountain team designed this cap for mountain trekking. When climbing, in intense heat, the cap's vents allow air to circulate, lessening the impact of the heat. ", "", "Ventilated Trekking Cap "]; products[221] = ["Trekking Waterproof Hat", 45, "Diamond Gym Gear", "Our team of trekking and hiking enthusiasts has designed this hat to protect you from the rain during your treks. The rain will no longer slow you down thanks to this waterproof trekking hat!", "", "Women's Fitness Bag"]; products[222] = ["Sports Bandana", 15, "Diamond Gym Gear", "A must have for all sports enthusiasts, this bandana keeps your perspiration in check, while also keeping sweat out of your eyes on the court. ", "", "Simple Stepper"]; products[231] = ["Microfibre Towel", 20, "Diamond Gym Gear", "Originally designed for swimmers and all other athletes who want to dry themselves effectively, these quick-drying & uber soft towels have become a favorite with workout enthusiasts as well. Limited space in your bag? This ultra-compact microfibre towel (L, 80 x 130 cm) dries very quickly and you can take it with you anywhere.", "", "Gym Duffle Bag"]; products[232] = ["Ab Workout Wheel", 30, "Diamond Gym Gear", "Our teams have designed this ab wheel to be taken anywhere so that you can work all your ab muscles at any time.. Allows you to work out your abs or obliques on your knees or on your toes, in stable or unstable modes. You'll continue to find this abs wheel useful as your fitness level increases.", "", "Ab Workout Wheel"]; products[233] = ["Training Knee Brace", 35, "Diamond Gym Gear", "Our designers have developed this sock for your hikes in extremely cold weather. Enjoy the snow with the warmest in the range.. These ultra-warm socks will give you maximum warmth thanks to the foot knitted in 100% Merino wool. The ventilation in the instep promotes moisture transfer and drying.", "", "Training Knee Brace"]; products[241] = ["Men's Running stopwatch", 175, "Diamond Gym Gear", "Designed for passionate runners for whom every second matters, the stopwatch helps you track your pace, distance, cadence, run splits & more. It also is great if you are looking to measure your performance at interval training. Priced right, this is a must have for any fitness enthusiasts, grab one before they stock out again!", "", "Gym Mat Black"]; products[242] = ["Gym Mat Khaki", 65, "Diamond Gym Gear", "The Yoga Mat was created for ultimate comfort. 20 mm thick cushioning and 190 cm long, this is the last workout mat you will ever need. The mat's surfaces, both top & bottom, come with anti-slip and anti-slide design, so you don't have to keep adjusting it after every rep!", "", "Gym Mat Khaki"]; products[243] = ["Gym Mat Pink", 65, "Diamond Gym Gear", "The Yoga Mat was created for ultimate comfort. 20 mm thick cushioning and 190 cm long, this is the last workout mat you will ever need. The mat's surfaces, both top & bottom, come with anti-slip and anti-slide design, so you don't have to keep adjusting it after every rep!", "", "Gym Mat Pink"]; products[244] = ["Gym Mat Blue", 65, "Diamond Gym Gear", "We created this soft mat to help you ease into learning yoga. Nature is present every time you step on the mat. The comfortable thickness lets you reconnect to your senses.", "", "Gentle Yoga Mat 10 mm"]; products[212] = ["Long Sleeves T-Shirt", 95, "Diamond Gym Gear", "Made for hikes, trails & cycling - these long sleeved T-shirts offer greater protection from natural factors - including the sun, rain, winds & snow. It offers superior stability, breathability, & moisture wicking - while the 1/2 zip offers ventilation as needed.", "", "Long Sleeves T-Shirt"]; products[214] = ["Polo Dry Fit T-Shirt", 75, "Diamond Gym Gear", "Created for golf enthusiasts who like to play the whole 18 holes, this T-Shirt offers complete comfort for all-day play! Its super lightweight, ultra bretable & provides a complete range of motion for the perfect swings!", "", "Polo Dry Fit T-Shirt"]; products[215] = ["Tennis T-Shirt ", 85, "Diamond Gym Gear", "Our sports apparel design team developed this T-shirt to keep you dry and comfortable when playing tennis. Also suitable for other racket sports. Thanks to its synthetic fabric, the t-shirt provides both excellent moisture management and superior comfort. It is also sure to make you stand out to the sports fashion police!", "", "Tennis T-Shirt "]; products[216] = ["Golf T-Shirt", 75, "Diamond Gym Gear", "Want to feel cool & comfortable in the full sun so you can swing & putt your very best? Look no further - our Golf T-Shirt has all the form, function & fashion that is a must have for the golfing greens. They are made with polyamide fabric to keep you super cool in the heat - while the open collar design is a super hit when it comes to sports fashion.", "", "Golf T-Shirt"]; products[217] = ["Tennis Polo T-Shirt", 80, "Diamond Gym Gear", "Created for all levels of tennis players, the Tennis Polo is a favorite amongst beginners & pro's alike - owing to its all-year wear build. It's super lightweight & comes with an airy mesh to keep you ventilated & on top of your game set after set. It is made with recycled polyester making it good for the planet & great for you too!", "", "Tennis Polo T-Shirt"]; products[217] = ["Swimming Boxers", 65, "Diamond Gym Gear", "These modern swimming boxers are developed for intermediate swimmers wanting to improve their technique and physique without worries. Want swimming boxers that will not slip off? Simple and modern, with very good support, the highly chlorine-resistant swimming boxers are ideal for helping you to swim for longer. ", "", "Swimming Boxers"]; products[219] = ["Swimming Briefs", 35, "Diamond Gym Gear", "These super comfortable & very affordable swimming briefs are a must have for the beach / pool season. They are lightweight, offer complete freedom of movement & offer chlorine-resistance.", "", "Training Shorts"]; products[220] = ["Workout Track Pants", 90, "Diamond Gym Gear", "Sweat managing straight fit track pants are the perfect combination of comfort & function. Made with 100% hydrophilic polyester fabric & a comfort fit design to allow you to train with greater flexibility. A favorite with gym rats, this is a must have for your workout wardrobe.", "", "Workout Track Pants"]; products[220] = ["Gym Shorts ", 65, "Diamond Gym Gear", "Whether you are a beginner or a pro at the gym, these shorts are the perfect for every kind of workout. Breathable, stretchy, lightweight, and do everything you need from a pair of fitness shorts at an affordable price.", "", "Gym Shorts"]; products[235] = ["Gym Tank Top", 75, "Diamond Gym Gear", "If you are looking to have maximum range of motion, enjoy seeing your pumps, while staying comfortable for those high intensity gym sessions, the tank top is the perfect choice. It comes with moisture wicking fabric to keep sweat away, while offering the best in class freedom of movement. A workout basic that meets your every need.", "", "Gym Tank Top"]; products[236] = ["Training T-Shirt ", 85, "Diamond Gym Gear", "The most versatile (& yes most colorful too) t-shirt in our collection is perfect for training, sports, lounging & more! It is made with stretch synthetic fabric to inspire complete freedom of movement, while the moisture wicking technology keeps you comfortable for those long sports sessions too! ", "", ""]; products[237] = ["", 40.93, "Diamond Gym Gear", "", "", ""]; products[238] = ["Compression T-Shirt", 39.93, "Diamond Gym Gear", "", "", ""]; console.log(products); var orderedItems = []; var orderedTotQty = 0; var maxQty = 10; var shipRates = false; var handling = 0; var carturl = "cart.php"; //Funtion adds Items to Cart var addItem = function(itemId, Qty) { 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(false, '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) { 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).size() == 1) { $('#prow-' + itemId).remove(); } $.cookie('order', order); $.cookie('orderedTotQty', orderedTotQty); showCart(false, '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-"]').size() > 0) { $('[id^="prow-"]').each(function(){ $(this).remove(); }); } showCart(false, 'empty'); }; //Displaying the cart items & calculations function showTotalPrice() { var cartHtml = ""; var total = 0; var shipping = 0; var grand_total = 0; var sub_total = 0; var shippingType = ''; 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)); if (prodId != "" && quantity > 0) { sub_total = round((quantity * products[prodId][1]), 2); total += (quantity * products[prodId][1]); } } total = round(total, 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); } //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-"]').size() == 0) { $("#cartBox").html("

You have not selected any product...

  Browse Products"); } showTotalPrice(); return false; } else { var items = order.split("|"); var total = 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 += "
Order Summary Price
"; cartHtml += "
Order Summary QtyUnit PriceTotal
"; var total = 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)); if (prodId != "" && quantity > 0) { orderedItems[prodId] = quantity; var sub_total = round((quantity * products[prodId][1]), 2); total += sub_total; cartHtml += "
" + "
" + "

" + products[prodId][4] + " " + products[prodId][0] + "

" + "
" + "" + ""+ "
"+ quantity +"
" + "
$" + (products[prodId][1]).toFixed(2) + "
" + "
$" + sub_total.toFixed(2) + "
" + "
" } } cartHtml += "
"; cartHtml += "
" +"
" +"
    " +"
  • Sub Total: $" + total.toFixed(2) + "
  • " +"
  • Shipping & Handling: $0.00
  • " +"
  • Total: $" + total.toFixed(2) + "
  • " +"
" +"
" +"
"; cartHtml += "
" if (cartHtml != "") { $("#cartBox").html(cartHtml); } else { $("#cartBox").html(" Loading..."); } return false; } }; var round = function(value, decimals) { return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals); };