var products = []; products[210] = ["Winter / Ski Top", 75, "Simply Fitness", "The perfect base layer for those cold & even snowy days - keeping you warm yet inspiring free movement for that perfect run down the slope or even a run. Enjoy a warm and comfortable base layer with a brushed component, flat seams and a stretch knit, that fits below your jackets with ease.", "", "Winter / Ski Top"]; products[211] = ["Bike Smartphone Holder ", 25, "Simply Fitness", "Carry your smartphone on your bile with the easy phone holder that mounts on the handlebar with a simple click. It protects your phone from rain or splashes, while letting you see the screen with ease.", "", "Hard Massage Roller/ Foam Roller"]; products[212] = ["Trail Running Tracks ", 90, "Simply Fitness", "The perfect tracks for the longest trail runs - no matter the terrain or the weather! Uber is comfortable with sweat / moisture wicking technology, it keeps your legs dry - come rain or sunshine. Compliant with the requirements of the major trail runs.", "", "Trail Running Tracks "]; products[213] = ["Hiking Fleece Jacket", 150, "Simply Fitness", "Designed by our team of hikers, this warm, breathable and affordable fleece for mountain walking & hiking use. A fleece that respects the planet, made from recycled polyester, perfect for protecting you from the cold!", "", "Hiking Fleece Jacket"]; products[214] = ["Daily Running Tracks ", 99, "Simply Fitness", "These trousers are designed for good perspiration wicking. They also have large mesh areas behind the knees. With an elastic waistband for more comfort. These trousers are so lightweight they will not cling to your skin when you perspire. These trousers have a zip at the ankles so you can get them on and take them off without removing your shoes.", "", "Daily Running Tracks"]; products[215] = ["Marathon Shorts With Pockets ", 65, "Simply Fitness", "Developed for mid & long distance running, these running shorts with built-in carrying capacity to reduce chafing while you run. Includes 5 pockets to carry small bottles, smart phones & more - giving you complete independence.", "", "Marathon Shorts With Pockets"]; products[105] = ["Cycling Shorts With Padding", 60, "Simply Fitness", "These durable mountain biking shorts have been designed for mid & long durationg rides across all weather types! Ride through the undergrowth with no worries across the summer, rains & winters. These comfy shorts absorb vibrations and prevent rubbing and chafing.", "", "Cycling Shorts With Padding"]; products[217] = ["Racket Sports Shorts", 65, "Simply Fitness", "Designed for tennis players, these comfortable shorts are perfect for any racket sports. These shorts provide maximum comfort thanks to their lightweight, breathable fabric and elastic waistband. The pockets easily hold 2 or 3 tennis / squash balls.", "", "Racket Sports Shorts"]; products[217] = ["Quick Dry Sports Shorts", 65, "Simply Fitness", "Created for sports enthusiasts who love to practice long & strong, these shorts ensure very quick drying of sweat & keeps you comfortable in terms of being lightweight & delivering freedom of movement. One of the most popular shorts amongst shuttle / badminton players.", "", "Quick Dry Sports Shorts"]; products[219] = ["Trail & Hike Shorts", 65, "Simply Fitness", "Lightweight and breathable, these shorts are perfect for intermediate hiking in the mountains.The perfect companion for your first hikes and you will appreciate these shorts for their light weight. Their stretch areas will also give you great comfort.", "", "Trail & Hike Shorts"]; products[220] = ["Tennis Shorts", 65, "Simply Fitness", "Created specifically for racket sports players, these shorts give you the comfort of losing duration play without feeling too hot. They are lightweight with good freedom of movement for total comfort during play. The above the knee design gives you the ease for rapid cour coverage. The large pockets can hold balls without getting in the way.", "", "Tennis Shorts"]; products[220] = ["Hiking Fleece", 125, "Simply Fitness", "Designed by our team of hikers, this warm, breathable and affordable fleece for occasional mountain walking use. A fleece that respects the planet, made from recycled polyester, perfect for protecting you from the cold!", "", "Hiking Fleece"]; products[238] = ["Rain Protection Hiking Jacket", 135, "Simply Fitness", "If you are a runner or hiker looking for rain protection, this jacket is the perfect companion. Keeps you 100% protected from the rain, while drying up quickly for the next use. Compact design ensures that it folds into its pocket. ", "", "Rain Protection Hiking Jacket"]; products[239] = ["Winter / Ski Jacket", 135, "Simply Fitness", "The warm and comfortable jacket is great for learning to ski in the snowy conditions. In addition to being warm, this jacket provides essential protection against the wind elements as well. Ideal for making the most of your skiing holiday - comfortable & safe.", "", "Winter / Ski Jacket"]; products[240] = ["Pro Cycling Jacket", 140, "Simply Fitness", "Crafted for long distance cyclists, the jacket is perfect to protect you from the strongest of winds & showers with its taped seams. Comes with large pockets to store any stuff that you need during your ride too!", "", "Pro Cycling Jacket"]; products[241] = ["Basketball Shorts", 65, "Simply Fitness", "Designed with basketball players in mind, these shorts double up as great training shorts for gym enthusiasts & runners alike! Lightweight and breathable, it will keep you dry as you play, train or run. It comes with superior moisture wicking technology to keep you dry & performing at your best with superior comfort.", "", "Basketball Shorts"]; products[245] = ["Training Shorts ", 65, "Simply Fitness", "The most versatile training shorts are perfect for the gym, runs, sports & even lounging around! Made with a blend of cotton & polyester, they are very comfortable & also keep sweat away. Comes in a cool blue color to add a little jazz to your workout wardrobe too!", "", "Basketball Shorts"]; products[246] = ["Dynamic Yoga Shorts ", 65, "Simply Fitness", "Our men's yoga design team created these woven shorts in a lightweight, stretchy fabric to take you from the office to the yoga studio. These shorts have a sleek look with a wide, flat waistband and two zip pockets. They're so light, you'll forget all about them on the mat.", "", "Basketball Shorts"]; products[221] = ["Smart Fitness Band", 150, "Simply Fitness", "Designed to help you keep a track of your activity levels with a glance. Enabled with step tracking, calorie counting, heart rate monitoring & inactivity reminders - the fitness tracker offers long battery life & superior durability. ", "", "Sports Bandana - Black"]; products[222] = ["Athletic Liner Gloves", 45, "Simply Fitness", "Perfect to keep you warm during a workout, run, or even while playing your sport in winters, the liner gloves are made with super soft fleece. The unisex gloves are one-size fits all made.", "", "Athletic Liner Gloves"]; products[223] = ["Hybrid Hiking Fleece ", 125, "Simply Fitness", "Crafted with the breakthrough body-heat mapping design, it provides protection from the warmth & also the wind on those cold hikes, walks & even runs. While loved by hikers, the lightweight design makes it a favorite among runners as well.", "", "Hybrid Hiking Fleece"]; products[224] = ["Dry Fit Polo T-Shirt", 75, "Simply Fitness", "Designed for tennis & other racket sports, the moisture-wicking fabric of the T-Shirt makes it perfect for on-court use - keeping you dry & comfortable. With the stylish body flattering cut, its also great for off-court use. ", "", "Dry Fit Polo T-Shirt"]; products[225] = ["Sports Crop Top Bra ", 65, "Simply Fitness", "While designed for high-performance gymnasts, this sports bra offers complete coverage & superior support - no matter how hard you like to train. The very stylish sequin design adds the zing to your workout too!", "", "Women Polyester Gym Leggings with Phone Pocket"]; products[226] = ["Dynamic Yoga Tank Top", 95, "Simply Fitness", "Looking for a top that feels like a second skin? With our Dynamic Yoga Tank Top that flatters your body's curves seamlessly - while giving you the perfect shape for every yoga position. Made with a blend of cotton & polyamide, its lightweight, moisture-wicking & breathable. ", "", "Dynamic Yoga Tank Top"]; products[227] = ["Long Sleeve Hooded Top", 135, "Simply Fitness", "A perfect companion for your gym, hikes, & runs, the long sleeves hooded top gives you the comfort & freedom of movement - while protecting you from the cold & wind. Comes with large yet compact pockets to help you store whatever you need - bottles, phone, energy bars & more. ", "", "Long Sleeve Hooded Top"]; products[228] = ["Zip-Turtle Long Sleeves ", 125, "Simply Fitness", "Advanced zip-turtle long-sleeve running top made of highly functional polyester jersey with loop back for extra comfort and warmth. Mesh at armpits for enhanced ventilation and fold-over sleeve ends with thumb grip to keep hands warm during cold days.", "", "Zip-Turtle Long Sleeves"]; products[229] = ["Workout Sports Bra", 65, "Simply Fitness", "This seamless knitted sports bra for your most intense workout sessions. The sports bra offers total comfort, softness and freedom of movement. Lined for increased opacity, with crossover straps for an athletic style.", "", "Workout Sports Bra"]; products[230] = ["Padded Sports Bra", 65, "Simply Fitness", "A padded sports bra with a thin layer of foam at the front for support, balance & coverage. Made with moisture wicking fabric & super stretch technology, it keeps you cool, comfortable & gives you the freedom of motion that you deserve. ", "", "Padded Sports Bra"]; products[235] = ["Hiking / Workout Sports Bra", 65, "Simply Fitness", "The lightest & thinnest sports bra in our collection fits in discreetly under your tees & jackets, while the compression stretch build offers optimal support when you need it the most. Designed for hiking & workout. ", "", "Hiking / Workout Sports Bra"]; products[236] = ["Modular Tracks ", 90, "Simply Fitness", "These clever convertible tracks have been created to be ultra-versatile, so you can adapt to the weather. These durable tracks have a reinforced main fabric and stretch inserts for good freedom of movement. Zip on and off with ease and switch between full tracks & comfy shorts.", "", "Women Polyester High-Waist Shaping Gym Shorts"]; products[237] = ["Women's Cycling Shorts", 75, "Simply Fitness", "These women's cycling shorts were created by our design team for frequent or lengthy rides. The waistband keeps these women's bibless cycling shorts comfortably in place. The triple-density ergonomic pad with gel inserts offers excellent comfort.", "", "Women's Cycling Shorts"]; products[247] = ["Yoga / Pilates Shorts", 70, "Simply Fitness", "Short, soft, comfy - these shorts are a must have for yoga, pilates, aerobics, zumba & even high intensity workouts. They are made with a blend of cotton & polyester to give you unparalleled comfort & freedom of movement.", "", "Yoga / Pilates Shorts"]; products[248] = ["Workout Leggings", 125, "Simply Fitness", "The perfect shaped leggings give you the warm gentle compression to boost blood circulation to support improved workout performance - while also flattering your curves to make you look and feel good! Made with moisture wicking fabric it keeps you dry and comfortable for even those extra-long workout sessions.", "", "Workout Leggings"]; products[249] = ["Seamless Yoga Pants", 125, "Simply Fitness", "Created for yoga enthusiasts, these super-stretch bottoms let you do your Surya Namaskar with enhanced ease and comfort. No matter how hot the weather or how much you sweat, the moisture wicking fabric keeps you dry & comfortable. ", "", "Seamless Yoga Pants"]; products[249] = ["Polyester Fitness Leggings", 125, "Simply Fitness", "High-waisted sport leggings for all your fitness activities, available in plain and print options.. These breathable, stretchy leggings with a high-waisted design are all about comfort. Plus, they're practical with a discreet pocket.", "", "Polyester Fitness Leggings"]; products[250] = ["Gymnastics Sports Bra", 55, "Simply Fitness", "While designed for high-performance gymnasts, this sports bra offers complete coverage & superior support - no matter how hard you like to train. The very stylish sequin design adds the zing to your workout too!", "", "Gymnastics Sports Bra"]; products[231] = ["Warm Ski Cap", 25, "Simply Fitness", "Made with soft yet thermally insulating fleece, the well fitted cap offers protection from the cold & is also very easy to care for. It is a must have for winter runs, under your ski headgear or even on a stroll to enjoy the first snowfall!", "", "Warm Ski Cap"]; products[232] = ["Gym / Athletic Bag", 50, "Simply Fitness", "The 55L capacity gym / athletic bag is designed to carry all your workout / sporting gear. It also folds up into its own pocket for super compact storage. It's durable & waterproof and also doubles up as your travel bag.", "", "Gym / Athletic Bag"]; products[233] = ["Running / Cycling LED Light", 45, "Simply Fitness", "The USB rechargeable LED light is designed to ensure you are seen in the dark with ease. Perfect to clip on to your cycle's back and even our t-shirt - its a must have accessory for all runners & cyclists.", "", "Running / Cycling LED Light"]; products[234] = ["MTB Yellow Sunglasses", 30, "Simply Fitness", "The MTB Sunglasses are perfect for cyclists & runners to shield against sun, wind, & even splashes. The UV filter lenses are great to protect your eyes as well. The glasses provide perfect visual contrast in poor weather to help you see better. ", "", "MTB Yellow Sunglasses"]; products[242] = ["Wrist Support Compression", 10, "Simply Fitness", "wrist support designed to support players' wrist with uniform joint compression.. This Soft 100 wrist support has a comfortable knit that wicks away perspiration so you can enjoy your sport with no distractions.", "", "Wrist Support Compression"]; products[243] = ["Protein Shaker ", 35, "Simply Fitness", "The 700 ml shaker was designed by our weight training team to help you easily and smoothly mix all protein powders. With a round base that's easy to clean. A secure cap that stays attached to the shaker so it never gets lost. With a secure snap-on cap.", "", "Protein Shaker"]; products[244] = ["Smart Watch ", 150, "Simply Fitness", "Gear up, optimize your workout ritual, keep a track of your fitness levels and stay connected round the clock with the help of this new-age high-end smartwatch that boasts a built-in real-time heart rate, calorie & sleep tracker and supports call-message function & App controls.", "", "Smart Watch "]; 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 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 += "
" +"
" +"" +"
" +"
" +"
"; +"
"; cartHtml += "
" +"Proceed To Checkout Continue Shopping Empty Cart
" +"
"; 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); };