var products = [];
products[214] = ["All Weather Jacket
- Neon Blue", 125, "SOD Athletics", "Made with waterproof & wind-cheating polyester, the full zipper jacket is perfect for cycling, running, jogging, hiking across weather conditions. It is sure to keep you dry & protected, while the large pockets safely store anything that you may need. The bright color ensures you are safe even in low-light conditions. ", "", 0,""];
products[215] = ["All Weather Jacket
- Neon Green ", 125, "SOD Athletics", "Made with waterproof & wind-cheating polyester, the full zipper jacket is perfect for cycling, running, jogging, hiking across weather conditions. It is sure to keep you dry & protected, while the large pockets safely store anything that you may need. The bright color ensures you are safe even in low-light conditions. ", "", 0,""];
products[216] = ["Hiking / Travel
Cargo Shorts ", 65, "SOD Athletics", "Our backpacker designers have designed these shorts so you can travel the world with peace of mind, in all environments.. Equipped with numerous pockets, including three secure ones, these durable cargo shorts are the perfect companion to see the action and discover the world's regions.", "", 0,""];
products[217] = ["Breathable
Running Tights ", 90, "SOD Athletics", "These breathable tights were crafted for comfortable running in spring and autumn.. The main fabric is made with recycled polyester. Moisture-wicking fabric that absorbs perspiration to keep you dry. Natural compression ensures better performance on your runs, jogs & even at the gym cardio session. ", "", 0,""];
products[218] = ["Cotton Longsleeve
Gym T-Shirt", 75, "SOD Athletics", "Both high-quality and a great deal, this T-shirt offers excellent freedom of movement.Perfect for a stylish look at the gym - or anywhere else!. This T-shirt has everything you could want: a great fit, a stylish design and breathable fabric. Plus, it"s made with 34% recycled polyester. You won"t want to take it off!", "", 0,""];
products[219] = ["Slim Fit
Athletic Tracks ", 90, "SOD Athletics", "For training regularly and reaching your goals. A fitted cut for this very stretchy model, which will follow you in all of your fitness activities thanks to a stretch insert between the legs made of very ventilated fabric.", "", 0,""];
products[220] = ["Gym / Jogging
Cotton Bottoms", 90, "SOD Athletics", "These are the ideal jogging bottoms - they're simple and comfy, making them perfect for sports or everyday wear. These bottoms feature a timeless cut and elasticated waistband plus excellent value for money - you won't want to take them off!", "", 0,""];
products[221] = ["Short Sleeve
Dry Fit T-Shirt ", 85, "SOD Athletics", "The must-have for your gym wardrobe, the short sleeve t-shirt is made with elastane & recycled polyester to give you complete freedom of movement, while the moisture-wicking technology keeps you dry and comfortable. ", "", 0,""];
products[222] = ["Back Racket Sports Shorts", 65, "SOD Athletics", "The perfect shorts fit for any racket sports that make you feel comfortable on and off the court. They are lightweight and perfectly cut above the knee to give you the freedom you need during play. They also include large pockets to hold tennis / squash balls during play. ", "
", 0,""];
products[223] = ["White Racket Sports Shorts", 65, "SOD Athletics", "The perfect shorts fit for any racket sports that make you feel comfortable on and off the court. They are lightweight and perfectly cut above the knee to give you the freedom you need during play. They also include large pockets to hold tennis / squash balls during play. ", "
", 0,""];
products[224] = ["Navy Racket Sports Shorts", 65, "SOD Athletics", "The perfect shorts fit for any racket sports that make you feel comfortable on and off the court. They are lightweight and perfectly cut above the knee to give you the freedom you need during play. They also include large pockets to hold tennis / squash balls during play. ", "
", 0,""];
products[225] = ["High Waist Shaped Leggings - Black", 125, "SOD Athletics", "These high-waisted shaping leggings offer great value-for-money and are perfect for all your workouts. A must-have.. You'll never want to take these leggings off: they have a high waist for maximum comfort, breathable and stretchy fabric, a shaping fit to hug your curves and a phone pocket!", "
", 0,""];
products[226] = ["High Waist Shaped Leggings - Red", 125, "SOD Athletics", "These high-waisted shaping leggings offer great value-for-money and are perfect for all your workouts. A must-have.. You'll never want to take these leggings off: they have a high waist for maximum comfort, breathable and stretchy fabric, a shaping fit to hug your curves and a phone pocket!", "
", 0,""];
products[227] = ["High Waist Shaped Leggings - Print", 125, "SOD Athletics", "These high-waisted shaping leggings offer great value-for-money and are perfect for all your workouts. A must-have.. You'll never want to take these leggings off: they have a high waist for maximum comfort, breathable and stretchy fabric, a shaping fit to hug your curves and a phone pocket!", "
", 0,""];
products[228] = ["Cotton Gym Shorts - Black", 75, "SOD Athletics", "Brighten up your wardrobe with these stylish sporty shorts that come in a range of fun & trendy colors. Plus, these shorts are made from organic cotton offering superior comfort, complete range of motion & enhanced breathability. ", "
", 0,""];
products[229] = ["Cotton Gym Shorts - Pink ", 75, "SOD Athletics", "Brighten up your wardrobe with these stylish sporty shorts that come in a range of fun & trendy colors. Plus, these shorts are made from organic cotton offering superior comfort, complete range of motion & enhanced breathability. ", "
", 0,""];
products[230] = ["Cotton Gym Shorts - Khaki ", 65, "SOD Athletics", "Brighten up your wardrobe with these stylish sporty shorts that come in a range of fun & trendy colors. Plus, these shorts are made from organic cotton offering superior comfort, complete range of motion & enhanced breathability. ", "
", 0,""];
products[230] = ["Cotton Gym Shorts - Blue ", 75, "SOD Athletics", "Brighten up your wardrobe with these stylish sporty shorts that come in a range of fun & trendy colors. Plus, these shorts are made from organic cotton offering superior comfort, complete range of motion & enhanced breathability. ", "
", 0,""];
products[231] = ["Golf Shorts", 80, "SOD Athletics", "Uber stylish, comfortable & functional these gold shorts have been designed to give you the perfect uninterrupted swing, made with moisture wicking fabric to let you walk the entire 18-hole with absolute comfort. The stylish design is perfect for a round of golf with the girls or even an on-course business meeting. ", "
", 0,""];
products[232] = ["2-in-1 Running Shorts ", 75, "SOD Athletics", "These women"s running shorts with built-in tight shorts have been designed for all runners who are sensitive to chafing when running.. These running shorts with built-in tight shorts reduce the rubbing of the fabric between the thighs. Their lightweight, well-ventilated fabric wicks away perspiration. Back zip pockets.", "
", 0,""];
products[233] = ["Seamless Gentle Yoga Sports Bra - Pink", 55, "SOD Athletics", "We created this seamless sports bra for gentle yoga in organic cotton and viscose for maximum comfort.. A cocoon of comfort! This second-skin sports bra has removable pads and a delicate design that supports without compressing for all your pranayamas.", "
", 0,""];
products[234] = ["Seamless Gentle Yoga Sports Bra - Black", 55, "SOD Athletics", "We created this seamless sports bra for gentle yoga in organic cotton and viscose for maximum comfort.. A cocoon of comfort! This second-skin sports bra has removable pads and a delicate design that supports without compressing for all your pranayamas.", "
", 0,""];
products[235] = ["High Support Sports Bra ", 95, "SOD Athletics", "This high-support sports bra is ideal for high-intensity cardio exercises.hiit, circuit training, treadmills.. A sports bra with superior support and a front zip to make it easier to put on. For more comfort: adjustable straps and built-in foam.", "
", 0,""];
products[236] = ["Light Supports Sports Bra ", 95, "SOD Athletics", "We developed this light support fitness bra for Pilates, gentle gym, gentle training, and strength training.. A sports bra with lace on the back. It is also very comfortable for gentle activities. The single cup design with holes enables better perspiration wicking.", "
", 0,""];
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();
$('#term-' + 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 += "" + products[prodId][4] + " " + products[prodId][2] + " " + products[prodId][0] + "
" + "