var products = []; products[210] = ["Hiking T-Shirt", 80, "Nashville Fit", "Drop Cut stylish design, loose fit, ventilated jacquard insert - makes this the most popular hiking t-shirt in our collection. Made with a blend of recycled cotton & polyester - they feel super-soft on the skin while being sustainable & planet-friendly too! ", "", "Hiking T-Shirt"]; products[213] = ["Running T-Shirt", 75, "Nashville Fit", "Made with a blend of polyester & elastane, this t-shirt gives you the dual benefit of cotton-like softness along with a quick-drying feature. The moisture-wicking nature of the fabric also keeps you dry on those long runs, while the feminine lines keep you looking & feeling your very best! ", "", "Running T-Shirt"]; products[223] = ["Running T-Shirt ", 75, "Nashville Fit", "Made with a blend of polyester & elastane, this t-shirt gives you the dual benefit of cotton-like softness along with a quick-drying feature. The moisture-wicking nature of the fabric also keeps you dry on those long runs, while the feminine lines keep you looking & feeling your very best! ", "", "Golf Polo T-Shirt "]; products[224] = ["Running T-Shirt ", 75, "Nashville Fit", "Made with a blend of polyester & elastane, this t-shirt gives you the dual benefit of cotton-like softness along with a quick-drying feature. The moisture-wicking nature of the fabric also keeps you dry on those long runs, while the feminine lines keep you looking & feeling your very best! ", "", "Dry-Fit Gym T-Shirt "]; products[225] = ["Training T-Shirt", 80, "Nashville Fit", "A versatile T-Shirt that is perfect for sports, working out at the gym, yoga, running and more. It comes with a super-stretch synthetic fabric, giving you a full range of motion, while the moisture-wicking fabric keeps you dry even on intensive training days. ", "", "Short Sleeved T-Shirt"]; products[226] = ["Trekking Tank Top ", 65, "Nashville Fit", "This Merino wool (62%) tank top will be your perfect companion for a summer trek. The wool’s properties reduce odours from perspiration. Its material is comfortable and soft. There is a small concealed pocket on the side for keeping valuables.", "", "Surfing Swimsuit Bottom"]; products[227] = ["1 Piece Swimsuit ", 95, "Nashville Fit", "Our design teams have developed this 1-piece swimsuit for the swimmer who is starting out and practices occasionally but still wants to swim without restrictions. With its U-shaped back, shorty shape that covers the buttocks and its built-in cups, this 1-piece swimsuit provides comfort and is easy to put on", "", "1 Piece Swimsuit "]; products[228] = ["Surfing / Beach Bottoms", 70, "Nashville Fit", "We designed this swimsuit for intermediate surfers surfing waves under one meter. This very stylish women’s shorty, with drawstring, has the ideal cut combining coverage and support in waves for intermediate surfers. It also doubles up as the perfect beach & pool wear, making it a must have in your summer wardrobe.", "", "Surfing / Beach Bottoms"]; products[229] = ["Cotton Gym Legging", 125, "Nashville Fit", "Our designer created these 7/8 leggings for anyone who wants to be stylish without sacrificing comfort, whether at the gym or out and about.. With a very comfortable high waist, soft stretchy fabric, a small key pocket and a very feminine design ", "", "Relaxed Running Pants "]; products[230] = ["Polyester Gym Leggings", 120, "Nashville Fit", "Available in a plain or a printed version, these leggings are THE go-to option for any sports activity.. An elasticated waistband, breathable, stretchy fabric that hugs your figure, a side pocket for your phone, plus the choice between two different prints!", "", "Polyester Gym Leggings"]; products[239] = ["Performance Swimsuit ", 90, "Nashville Fit", "We developed this one-piece training swimsuit for advanced swimmers looking for support and an athletic shape. This one-piece swimsuit offers both - a high-cut leg and good support & coverage. With its close fit and elastic straps, this swimsuit creates a second-skin effect by limiting any water ingress. ", "", "Performance Swimsuit "]; products[240] = ["Hiking / Walking Shorts", 65, "Nashville Fit", "Lightweight, breathable & moisture-wicking, these shorts are perfect to wear on casual hikes on the plain, in the forest or on the coast. The stretch cotton fabric provides comfort and freedom of movement. These shorts have five pockets to store all your essential items! The big bow design keeps your style quotient high! ", "", "Hiking / Walking Shorts"]; products[300] = ["Sport Beach Golf Visor Cap", 20, "Nashville Fit", "This visor keeps the sun out of your eyes and your hair out of your face,therefore it does what it’s intended to do.while still letting you keep your hair up off your neck in the summer sun!It's very plain and feels well made the velcro adjustment band will not get stuck in your hair and it had a good length to it so it should fit most anyone!", "", "Sport Beach Golf Visor Cap"]; products[245] = [" ", 40.91, "Nashville Fit", "", "", " "]; products[211] = ["Protein Shaker Bottle", 20, "Nashville Fit", "The unique 500 ml. a protein shaker bottle comes with an easy mixer with precision measurements and can hold up to 2 scoops of your favorite protein powder. Its leak proof cap ensures you can carry it without the worry of spills. It is made with non-toxic plastic and is completely BPA free, making it safe for use.", "", "Protein Shaker Bottle"]; products[221] = ["Unisex Gym Gloves", 55, "Nashville Fit", "These unisex gym gloves are perfect to give you the grip and cushion you need in the gym, making the lifts and reps more comfortable. Enabled with dry-fit fabric tech, they keep sweat away.", "", "Unisex Gym Gloves"]; products[222] = ["Gym Bag", 70, "Nashville Fit", "Our leather gym bag is the latest addition to our accessories category. It comes in the perfect black color and gives your gym look a touch of sexy style too!", "", "Gym Bag"]; products[231] = ["Resistance Bands", 60, "Nashville Fit", "The most popular at-home-workout system, these resistance bands let you enjoy a whole body workout right in the comfort of your home - no expensive equipment, no gym membership! They come in 5 intensity options so you can level up as you go!", "", "Resistance Bands"]; products[232] = ["Compression Knee Sleeves", 35, "Nashville Fit", "Compression Knee Sleeves are a special type of performance wear that provide warmth, support, and better blood flow to your knees so you can reduce swelling and pain during or after activity, and perform at a higher level every day.", "", "Compression Knee Sleeves"]; products[233] = ["Gym Mat Black", 138, "Nashville Fit", "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 Black"]; products[241] = ["Simple Stepper", 95, "Nashville Fit", "This stepper was designed for all your choreographed or functional step workouts combining cardio and strength training exercises. Its compact design makes the stepper perfect for home workouts. We have made sure it grips the floor really well and remains stable so that you can enjoy a great workout.", "", "Simple Stepper"]; products[242] = ["Ventilated Fitness Cap", 38, "Nashville Fit", "The lightweight & ventilated cap is perfect for outdoor fitness enthusiasts to keep air circulation on while working out, hiking, running in intense heat. While being absolutely functional the design keeps you spot on when it comes to style.", "", "Ventilated Fitness Cap"]; products[243] = ["Smart Fitness Tracker", 45, "Nashville Fit", "Smart fitness tracker gives you real-time health & fitness insights, tracks your progress & guides you to reach your goals, everyday. Lightweight, water resistant, iOS & Android compatible, the fitness tracker is a must have ally that offers monitoring & motivation on your wrist!", "", "Smart Fitness Tracker"]; products[244] = ["Smart Scale", 25, "Nashville Fit", "The most advanced fitness scale, it does so much more than track your weight. It tracks 14 health & fitness parameters, keeps a log, helps you check your progress & reach your fitness goals. It connects to your smart phone and handles multiple user profiles - making it perfect for the entire family.", "", "Jump Rope"]; products[250] = ["Jump Rope", 11, "Nashville Fit", "This jump rope is made of steel wires that are coated with strong PVC material, making it durable even after a long time exercising. Its adjustable length design enables you to customize the length according to your needs, making it suitable for everyone, no matter for kids or adults.", "", "Smart Scale"]; products[251] = ["Fitness & Yoga Mat", 25, "Nashville Fit", "Fitness mats are perfect for low-impact exercise, core training, and stretching for group fitness glasses in gyms and clubs - when finished, mats easily store on the Wall-Mounted Hanging Exercise Mat Rack", "", "Fitness & Yoga Mat"]; products[252] = ["Interlocking Foam Floor Tiles", 35, "Nashville Fit", "Protective Exercise Flooring - Durable, non-skid textured squares and tiles that cover and protect your floor or even carpet while creating a comfortable workout room with exercise accessories or as a play mat for children.", "", "Interlocking Foam Floor Tiles"]; products[253] = ["LAT Pull Down V Bar", 29, "Nashville Fit", "Handles with textured surface for non-slip increase the secured and firm grip to your hands during exercise cable attachment workouts. Fits perfectly in your palms when exercising, and 0.59 inch hole is compatible with cable machine systems.", "", "LAT Pull Down V Bar"]; products[254] = ["Attachment Cable ( Pulldown )", 18, "Nashville Fit", "Heavy-duty nylon rope maximizes weight load capacity and resists fraying. Rubber end helps ensure a secure grip. Add more options to your functional trainer or cable machine, allowing you to execute a variety of single arm exercises", "", "Attachment Cable ( Pulldown )"]; products[255] = ["Microfiber Sweat Towel", 25, "Nashville Fit", "The perfect addition to your gym bag and work out gear to wipe up sweat, cover a workout bench, hang on the bike or treadmill, use as a yoga towel, and more. Machine washable and durable to use in the gym, a home gym, on a walk, or as a travel towel", "", "Microfiber Sweat Towel"]; products[256] = ["LAT Pulldown Attachment", 22, "Nashville Fit", "Multifunctional snap hook that you can use to attach and carry keys water bottles camping gear hang lanterns and lights. Very durable and great for backpack, key ring, camping, hiking, fishing, pet, indoor outdoor equipment gear, DIY accessories.", "", "LAT Pulldown Attachment"]; products[257] = ["Triceps LAT Pulldown", 35, "Nashville Fit", "Build your own home gym by using our pulldown straight bar, come with a heavy duty connection that could attach to any universal cable machine gym system, resistance bands, weight pulley system and so on. This press down bar is made of high quality alloy steel with smooth weld craftsmanship, could support 550 lbs.", "", "Triceps LAT Pulldown"]; products[258] = ["Rebound Abdominal Wheel", 47, "Nashville Fit", "Rebound abdominal roller features a wide, dual-wheel design for enhanced stability compared to a single wheel. With built-in automatic rebound springs, it requires low strength and balance, making it beginner-friendly for fitness enthusiasts.", "", "Rebound Abdominal Wheel"]; products[259] = ["Push Up Bars", 28, "Nashville Fit", "Push up bars help you achieve deeper and more effective push-ups by elevating your hands off the ground and reducing the strain on your wrists and elbows. These exercises can target different muscle groups, such as chest, shoulders, arms, back, and core, and improve your strength, endurance, and posture.", "", "Push Up Bars"]; products[260] = ["Ankle Workout Straps", 18, "Nashville Fit", "Ankle Workout Straps for Tonal Accessories with T lock adapter, Ankle Kit Is an attachment used to connect your foot to the cable machine and other workout equipment, Easy to adjust (2 Kit).These ankle straps meet your needs, improve hip and leg lines through exercises, and ankle straps help with body building and strength training.", "", "Ankle Workout Straps"]; products[261] = ["Weight Stack Pin", 19, "Nashville Fit", "Our weight stack pin is made of high quality aluminium alloy material, strong and durable. Not easy to break, reliable quality and long service life. This magnetic weight pin is easy and quick to install, easy to use and good performance.", "", "Weight Stack Pin"]; products[262] = ["Aerobic Stepper", 55, "Nashville Fit", "Challenge your workout with 3 settings of adjustable height, you can raise or lower the height according to self requirements. Platform textured surface is secure, non-stick, non-slip, and shock absorbing, ensure you exercise easily and safely. Also comes with four nonskid feet on each riser to prevent it from sliding during exercise and scratching floors", "", "Aerobic Stepper"]; products[263] = ["Pushup Board", 35, "Nashville Fit", "Pushup Board makes your workout more scientific and more effective. With 30 slots for the grips, the push up challenge board primarily strengthens your chest, triceps, shoulders, and back. The push up board doesn't work for one muscle group at a time, but you can clearly feel it more intensely in targeted areas.", "", "Pushup Board"]; products[264] = ["Triceps Rope", 19, "Nashville Fit", "Come with a heavy duty connection that could attach to any universal cable machine gym system, resistance bands, weight pulley system and so on. Tricep rope with soft rubber ends to keep your hand from slipping, soft rubber provides a comfortable hand feel.", "", "Triceps Rope"]; products[265] = ["Sit up Exercise Equipment", 27, "Nashville Fit", "The sit up exercise equipment can be adsorbed on various smooth floors, such as ceramic tile floor, marble floor, and smooth wood floor.It cannot be used on concrete floors.So you can exercise in the living room, the office, the park and other places to create perfect abdominal muscles.", "", "Sit up Exercise Equipment"]; products[266] = ["Resistance Cord Elastic Rope", 47, "Nashville Fit", "Experience a safe and effective workout with the bungee resistance band. Made with high-tensile latex, this band offers optimal resistance and durability for all your strength training needs.Whether you're doing aerial training or other strength training exercises, this resistance band has got you covered.", "", "Resistance Cord Elastic Rope"]; products[267] = ["YBell", 155, "Nashville Fit", "The YBell is a dumbbell, kettlebell and push-up stand all in one tool. With the YBell, a grip change is an equipment change. By changing your grip on the YBell, the weight distribution shifts changing it from one piece of equipment to another.", "", "YBell"]; products[268] = ["Adjustable Step Platform Trainer", 25, "Nashville Fit", "Raisers are included, so you can adjust the platform among 4-inch and 6-inch high of your choice. Textured surface is non-slip, and shock absorbing, the surface is a slip-free, meaning you can have stability with every single set of steps.", "", "Adjustable Step Platform Trainer"]; products[269] = ["Sling Trainer Set", 48, "Nashville Fit", "It doesn't matter what exercise you want to do. This resistance trainer can help you do it. Use your body weight to do full-body workouts from anywhere, your home, your office or outside in the park!.The useful tool is made of high quality material so you don't have to be afraid to hang on to it with your body weight. The resistance trainer will not wear out easily because of the material. Also the handles are made of sturdy rubber which makes sure the exercises can be done safely.", "", "Sling Trainer Set"]; products[270] = ["Thigh Workout Equipment", 26, "Nashville Fit", "This product can help strengthen the muscles in your legs, including the quadriceps, hamstrings, and calf muscles. They are particularly useful for isometric leg contractions, which can build leg strength over time.This item is not limited to leg exercises. it can also be used for arm and chest workouts. For example, you can use it to perform chest presses or arm curls, effectively engaging the muscles in your upper body.", "", "Thigh Workout Equipment"]; products[271] = ["Resistance Bands Set", 45, "Nashville Fit", "This product can help strengthen the muscles in your legs, including the quadriceps, hamstrings, and calf muscles. They are particularly useful for isometric leg contractions, which can build leg strength over time.This item is not limited to leg exercises. it can also be used for arm and chest workouts. For example, you can use it to perform chest presses or arm curls, effectively engaging the muscles in your upper body.", "", "Resistance Bands Set"]; products[272] = ["Attachment for Barbell", 23, "Nashville Fit", "The barbell bomb is 6.3inch high, the base is solid to make the barbell bar fit the ground better, the mine base is 1.3lbs.Tightly fit 2-inch steel barbell does not shake all solid odorless silicone material. Made of strong natural rubber with a maximum load capacity of 450 pounds and durability to withstand the weight of a barbell.", "", "Attachment for Barbell"]; products[273] = ["Yoga Foam Wedge Blocks", 19, "Nashville Fit", "Soft blocks can be used in a variety of poses, including forwarding, backward, and sideways, to expand exercise routines. Whether you're a beginner or a pro, the wedge-shaped design of the yoga block will prevent you from injuring your wrists and achieving a further level.", "", "Yoga Foam Wedge Blocks"]; products[274] = ["Gym Extension Cable", 27, "Nashville Fit", "Home Gym Replacement Cables is compatible with most home gym cable extensions, replacing the Gym Extension to add approximately 10 inches of cable length.,for accessories such as pull-down and triceps push-down, as well as some leg movements, it serves as a convenient extension to make the workout better.", "", "Gym Extension Cable 10"]; products[275] = ["Athletic Hair Bands", 15, "Nashville Fit", "You will receive a total of 6 thin elastic sports headbands in black and 6 in gray,which can be worn by both men and women and are plentiful and easy to match for your daily use and replacement.", "", "Athletic Hair Bands"]; products[275] = ["Headband Wristband Set", 14, "Nashville Fit", "Our Pink Sweatband headbands are 7 x 2 inches and sweatband wristbands are 3x3 inches. They are made up of 70% Polyester Cotton/12% Spandex/18% Latex. The comfortable, soft, and stretchy fabric will keep you warm in the winter and cool in the summer. This sport headband wristband set will stop the sweat from running down your forehead and into your eyes, so you can focus and finish strong! Grab yourself the best sweat absorbing set.", "", "Headband Wristband Set"]; products[276] = ["Exercise Matts (6pcs)", 27, "Nashville Fit", "Very soft and comfortable. Suitable for sports kneepad, fitness body building, dance sports, health massage. Made of high- quality TPE material, soft and comfortable, it can be easily cleaned with a damp cloth after practice.", "", "Exercise Matts (6pcs)"]; products[277] = ["LAT Pulldown Bar", 46, "Nashville Fit", "The pulldown bar made of heavy duty alloy steel with a well-paint matte black finished for long lasting use, support 800 lbs. Handle position adjustable from narrow to wide by adjusting the star hand knob on the bar, perfect for cable machine LAT pull down, row, press, cross training", "", "LAT Pulldown Bar"]; products[278] = ["Battle Exercise Training Rope", 52, "Nashville Fit", "100% polypropylene and polyester, wear and durable, high tensile strength. The end of the handle cover is thickened and lengthened, so that the rope is not easy to slip off your hand, providing a better grip for your daily training, and moderately strengthening the hand.
Length: 50 feet ", "", "Battle Exercise Training Rope"]; products[279] = ["Headband - 3 Pack", 15, "Nashville Fit", "Sports headband performance stretch,moisture wicking, Non-slip,lightweight and natural soft feel, friendly to your skin.Our sweatband will not be a drag on you when you work out. Our headband is very elastic!, it can be easily adjusted to suit your specific needs and ensure maximum comfort at all times. Forget about your old, tight and boring headband that only caused you discomfort in the past.", "", "Headband - 3 Pack"]; products[280] = ["Sun Visor Cap", 8, "Nashville Fit", "You will be amazed if you give this newly designed unique style visor hat a try. This visor keeps the sun out of your eyes and your hair out of your face, therefore it does what its intended to do. The empty top baseball cap designed for ventilation to accelerate sweat evaporation. It doesn't feel sultry in the hot summer.", "", "Sun Visor Cap"]; products[212] = ["Short Sleeve Dry Fit T-Shirt", 85, "Nashville Fit", "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.", "", "Compression Tights"]; products[214] = ["Swim / Beach Shorts ", 65, "Nashville Fit", "Tired of baggy swim shorts? Well, our version of swim shorts are knitted with chlorine-resistant fabric while also being water repellent to encourage quick drying. They are perfect for the pool or open waters, giving you the perfect function and fashion for a swim.", "", "Swim / Beach Shorts "]; products[215] = ["Basic Swim Jammer", 70, "Nashville Fit", "Our design teams have developed these swimming shorts for men wanting to get into swimming. Don’t know if you’ll like swimming, if the water is your element? These low-price swim shorts are perfect for a first try at swimming or for occasional use.", "", "Basic Swim Jammer"]; products[216] = ["Sailing Shorts ", 65, "Nashville Fit", "Developed in consultation with pro-sailors these inshore sailing bermuda shorts for sailing in warm weather. These sailing bermuda shorts provide great ease of movement thanks to the elastane and are very practical with their 6 pockets, including 2 secure zipped pockets.", "", "Sailing Shorts "]; products[217] = ["Trekking Shorts", 60, "Nashville Fit", "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!", "", "Trekking Shorts"]; products[249] = ["Running Pants ", 128, "Nashville Fit", "Perfect for all-year-round wearing, these running pants are lightweight, breathable & moisture wicking. They come with 2 zip pockets & provide optimal comfort for walks, runs, & even light workout. ", "", "Running Pants "]; products[219] = ["Tennis Shorts ", 65, "Nashville Fit", "Originally crafted for tennis & racquet ball players, the sheer comfort & breathability of these shorts have made it a favorite with runners & gym-goers alike. The lightweight shorts come with elasticated waistband along with 2 pockets to hold 2 - 3 tennis balls or your phone / keys & more. ", "", "Tennis Shorts"]; products[220] = ["Hiking Pants ", 128, "Nashville Fit", "Ultra lightweight, these hiking pants offer bi-strech function giving you a complete range of motion on the most challenging of trails. The moisture wicking fabric dries away perspiration to ensure all-day comfort. They also double up as loungewear when you need it! ", "", "Workout Track Pants"]; products[234] = ["Golf Pants", 150, "Nashville Fit", "Loved by casual & pro's alike - these golf pants ensure that you enjoy the complete course with optimal comfort. The perfect cut & stretch fabric gives you the freedom you want for those long swings, while the moisture wicking fabric ensures you stay dry even when the sun is out.", "", "Golf Pants"]; products[235] = ["Compression Tights", 90, "Nashville Fit", "Every workout makes a difference. These men's tights feature a quick-drying build and mesh inserts to help keep you dry and cool through every stage of your workout. A compression fit matches body flex for an unrestricted range of motion.", "", "Compression Tights"]; products[236] = ["Workout Shorts", 88, "Nashville Fit", "The most versatile pair of shorts in our men's collection - this pair is perfect for any workout of your choice - pumping iron at the gym, yoga at the beach, running & hiking or even racquet sports. The shorts include a super stretch fabric that is breathable, moisture wicking & lightweight. ", "", "Compression Tights"]; products[237] = ["Daily Fitness T-Shirt", 78, "Nashville Fit", "Perfect for training regularly and reaching your goals, the T-shirt is made from very soft, breathable fabric for added comfort and technical features. Plus, the insert on the back and under the arms lets air circulate and removes unpleasant odors.", "", "Daily Fitness T-Shirt"]; products[238] = ["Hiking Synthetic T-Shirt", 68, "Nashville Fit", "Our team of enthusiasts designed this lightweight, breathable t-shirt for regular mountain walking. It is very comfortable thanks to its moisture absorption and perspiration wicking properties.", "", "Daily Fitness T-Shirt"]; products[246] = ["Long Sleeves Gym T-Shirt", 88, "Nashville Fit", "For training regularly and reaching your goals.. Long-sleeved technical T-shirt: breathable and stretchy for 360° movement with a flattering style.", "", "Long Sleeves Gym T-Shirt"]; products[247] = ["Training Tank Top", 55, "Nashville Fit", "For training regularly and reaching your goals. This model has a modern and sporty design. The stretchy, breathable fabric makes it a technical tank top that will help you reach your goals.", "", "Long Sleeves Gym T-Shirt"]; products[248] = ["Fitness Tracksuit Jacket", 135, "Nashville Fit", "A universal fitness jacket you can wear every day.. This lightweight, breathable jacket absorbs perspiration then wicks it away to the outer surface of the fabric for maximum comfort.", "", "Daily Fitness T-Shirt"]; 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).length == 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-"]').length > 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-"]').length == 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); };