var products = []; products[210] = ["Multifunctional Zipper Tool Pouch", 6.97, "Productive Tools Shop", "This durable portable toolbox is crafted from shock-absorbent PU/EVA materials that may keep your tools safe from impacts, scratches, and moisture. Featuring a spacious interior with elastic straps, it may securely organize small parts and power tools like circular saws while remaining lightweight for easy transport. The semi-waterproof design may offer complete protection against wear, drops, and daily job site demands.", "", "X 1", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[211] = ["Multifunctional Zipper Tool Pouch", 9.97, "Productive Tools Shop", "", "", "X 2", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[212] = ["Multifunctional Zipper Tool Pouch", 13.47, "Productive Tools Shop", "", "", "X 3", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[213] = ["Electrical Wire Cable Cutters", 14.97, "Productive Tools Shop", "This wire cutter is crafted from strengthened steel with a thickened body, which may help provide superior torque. Its finely ground, polished cutting edge is sharp, clean, and rust-resistant, while overall heat treatment may help ensure stability and a wobble-free experience. The high-frequency quenched cutting edge offers exceptional hardness and sharp, clean cuts, which may help extend its lifespan.", "", "X 1", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[214] = ["Electrical Wire Cable Cutters", 19.97, "Productive Tools Shop", "", "", "X 3", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[215] = ["Four-Digit Password Lock", 29.97, "Productive Tools Shop", "This 4-digit combination lock may help give you peace of mind whether you're away or at work. Made from high-quality, long-lasting materials, this locker lock may help withstand daily wear and tear, offering resistance to rust and corrosion. Its weatherproof feature may make it ideal for outdoor use. Its compact size and lightweight design make this combination padlock convenient to carry with you wherever you go.", "", "X 1", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[216] = ["Four-Digit Password Lock", 59.97, "Productive Tools Shop", "", "", "X 2", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[217] = ["Four-Digit Password Lock", 97.48, "Productive Tools Shop", "", "", "X 3", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[218] = ["Household Hardware Tool Box Set", 39.97, "Productive Tools Shop", "Designed with your convenience in mind, our tool kit is both lightweight and equipped with a sturdy carrying handle. This portability may help make it incredibly easy to transport wherever your projects take you, whether it's from room to room or to a friend's house. Beyond its practical benefits, this comprehensive tool set also may make a thoughtful and practical gift choice for anyone, from a budding DIY enthusiast to an experienced handyman, ensuring they're well-equipped for their next endeavor.", "", "X 1", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[219] = ["Household Hardware Tool Box Set", 129.97, "Productive Tools Shop", "", "", "X 4", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[220] = ["39 Pockets Tool Belts For Men", 89.98, "Productive Tools Shop", "The tool pouch features 39 pockets, loops, hanging rings, hammer holders, magnetic pads, and a tape measure buckle. Its large capacity design may help you easily organize a variety of tools, such as drills, screwdrivers, pliers, wrenches, tape measures, water bottles, plugs, multimeters, tape, ties, art knives, and even hand drill lithium batteries. The interior & roomy tool pouches for carpenters help access the roofing tools and carpentry tools quickly.", "", "X 1", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[221] = ["39 Pockets Tool Belts For Men", 169.97, "Productive Tools Shop", "", "", "X 2", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[222] = ["LED Flashlight", 49.97, "Productive Tools Shop", "This compact LED flashlight kit may help with a variety of tasks, offering up to 600 lumens of light output and three different light modes. With a durable, water and dust resistant design, it may provide up to 18 hours of runtime, making it ideal for workspace, outdoor activities, or emergency situations. The kit includes a rechargeable battery with a USB-C port that may also charge mobile devices and features an LED fuel gauge to show the remaining battery life. The light also has an indicator to signal when the battery is charged or low.", "", "X 1", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[223] = ["LED Flashlight", 119.97, "Productive Tools Shop", "", "", "X 3", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; products[224] = ["LED Flashlight", 159.97, "Productive Tools Shop", "", "", "X 4", "By clicking the Complete Checkout button and submitting this order, I agree that my card will be charged $ __prc__ + $0.00. If this product is not right for me, or I have any questions, contact customer service with any questions by calling 800-330-8079 or e-mailing support@productivetoolsshop.com. Charges will appear on my credit card statements as 8003308079productiveto. Standard shipping orders will be processed and shipped with USPS within about 1 business day. Shipping time is estimated to be 5-7 business days from when your order ships out. Thank you for your business."]; console.log(products); var orderedItems = []; var orderedTotQty = 0; var maxQty = 10; var shipRates = false; var handling = 0; var carturl = "cart.php"; // Function to check item exists in cart var checkItemExists = function(itemId) { var order = $.cookie('order'); if (!order) { return false; } else { var itemExists = false; var items = order.split("|"); order = ""; for (var i = 0; i < items.length; i = i + 1) { var position = items[i].indexOf("-"); var prodId = items[i].substring(0, position); var quantity = parseInt(items[i].substring(position + 1)); if (order != "") { order += "|"; } if (prodId == itemId) { return true; } } } return false; } //Funtion adds Items to Cart var addItem = function(itemId, Qty, showFullCart) { if (typeof showFullCart === "undefined") { showFullCart = false; } orderedTotQty = $.cookie('orderedTotQty'); if (!orderedTotQty) { orderedTotQty = 0; } Qty = parseInt(Qty); if(Qty > maxQty) { alert("Maximum " + maxQty + " of this product can be selected in a single order"); return false; } var order = $.cookie('order'); if (!order) { order = itemId + "-" + Qty; orderedItems[itemId] = Qty; } else { var itemExists = false; var items = order.split("|"); order = ""; for (var i = 0; i < items.length; i = i + 1) { var position = items[i].indexOf("-"); var prodId = items[i].substring(0, position); var quantity = parseInt(items[i].substring(position + 1)); if (order != "") { order += "|"; } if (prodId == itemId) { alert("Product already exist in cart"); return false; if((quantity + Qty) > maxQty) { alert("Maximum " + maxQty + " of this product can be selected in a single order"); return false; } quantity += Qty; order += prodId + "-" + quantity; itemExists = true; } else { order += prodId + "-" + quantity; } orderedItems[prodId] = quantity; } if (!itemExists) { if (order != "") { order += "|"; } order += itemId + "-" + Qty; orderedItems[itemId] = Qty; } } orderedTotQty = parseInt(orderedTotQty); orderedTotQty += Qty; $('.cartqty').html(orderedTotQty); $.cookie('order', order); $.cookie('orderedTotQty', orderedTotQty); var url = window.location.pathname; var filename = url.substring(url.lastIndexOf('/') + 1); if (filename == carturl) { showCart(showFullCart, 'add', itemId); } else { $(location).attr('href', carturl); } }; //Funtion decrements Items to Cart var removeItem = function(itemId, Qty) { Qty = parseInt(Qty); var order = $.cookie('order'); if (!order) { orderedItems[itemId] = 0; refreshRow(itemId); } else { var items = order.split("|"); order = ""; for (var i = 0; i < items.length; i = i + 1) { var position = items[i].indexOf("-"); var prodId = items[i].substring(0, position); var quantity = parseInt(items[i].substring(position + 1)); if (prodId == itemId) { quantity -= Qty; if (quantity > 0) { if (order != "") { order += "|"; } order += prodId + "-" + quantity; } itemExists = true; orderedItems[prodId] = quantity; refreshRow(itemId); } else { if (order != "") { order += "|"; } order += prodId + "-" + quantity; orderedItems[prodId] = quantity; } } } orderedTotQty -= Qty; $('.cartqty').html(orderedTotQty); $.cookie('order', order); $.cookie('orderedTotQty', orderedTotQty); var url = window.location.pathname; var filename = url.substring(url.lastIndexOf('/') + 1); if (filename == carturl) { showCart(false, 'remove', itemId); } else { $(location).attr('href', carturl); } }; //Funtion sets Item quantity on the Cart var setItemQty = function(itemId, Qty) { Qty = parseInt(Qty); if(Qty > maxQty || Qty < 0) { return false; } var order = $.cookie('order'); orderedTotQty = 0; if (!order) { orderedItems[itemId] = 0; } else { var items = order.split("|"); order = ""; for (var i = 0; i < items.length; i = i + 1) { var position = items[i].indexOf("-"); var prodId = items[i].substring(0, position); var quantity = parseInt(items[i].substring(position + 1)); if (prodId == itemId) { quantity = Qty; if (order != "") { order += "|"; } order += prodId + "-" + quantity; itemExists = true; } else { if (order != "") { order += "|"; } order += prodId + "-" + quantity; } orderedItems[prodId] = quantity; orderedTotQty += quantity; } } $('.cartqty').html(orderedTotQty); $.cookie('order', order); $.cookie('orderedTotQty', orderedTotQty); var url = window.location.pathname; var filename = url.substring(url.lastIndexOf('/') + 1); if (filename == carturl) { showCart(false, 'set', itemId); } else { $(location).attr('href', carturl); } }; var removeRowItem = function(itemId, showFullCart) { if (typeof showFullCart === "undefined") { showFullCart = false; } var order = $.cookie('order'); if (!order) { orderedTotQty = 0; } else { var items = order.split("|"); order = ""; orderedTotQty = 0; orderedItems = null; orderedItems = new Array(); for (var i = 0; i < items.length; i = i + 1) { var position = items[i].indexOf("-"); var prodId = items[i].substring(0, position); var quantity = parseInt(items[i].substring(position + 1)); if (prodId == itemId) { } else { if (order != "") { order += "|"; } order += prodId + "-" + quantity; orderedTotQty += quantity; orderedItems[prodId] = quantity; } } } if($('#prow-' + itemId).length == 1) { $('#prow-' + itemId).remove(); $('#term-' + itemId).remove(); } $.cookie('order', order); $.cookie('orderedTotQty', orderedTotQty); showCart(true, 'removerow', itemId); }; //Emptying the cart var emptyCart = function() { var order = $.cookie('order'); order = ""; orderedTotQty = 0; orderedItems = null; orderedItems = new Array(); $.cookie('order', order); $.cookie('orderedTotQty', orderedTotQty); if($('[id^="prow-"]').length > 0) { $('[id^="prow-"]').each(function(){ $(this).remove(); }); } 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)); $(".tot-prc").html('$' + total.toFixed(2)); }; // Refresh row content with updated quantity / price for a product function refreshRow(pid) { pid = parseInt(pid); quantity = orderedItems[pid]; sub_total = round((quantity * products[pid][1]), 2); $('#prow-' + pid + ' .tot-price').html('$' + sub_total.toFixed(2) + ' USD'); $('#prow-' + pid + ' .qtybox').val(quantity); $('#prow-' + pid + ' .dispqty').html(quantity); } function replaceAllStr(str, find, rstr) { //return str.replace(new RegExp(escapeRegExp(find), 'g'), replace); //return str.replace(/find/g, '\\$&'); return str.replace(new RegExp(find, "g"), rstr); } //Displaying the cart items & calculations function showCart(showFullCart, act, itm) { var cartHtml = ""; var order = $.cookie('order'); orderedTotQty = $.cookie('orderedTotQty'); if (!order) { orderedTotQty = 0; if($('[id^="prow-"]').length == 0) { $("#cartBox").html("

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 TotalQuantitySub TotalTotal
"; var total = 0; var term_htm =''; for (var i = 0; i < items.length; i = i + 1) { var position = items[i].indexOf("-"); var prodId = items[i].substring(0, position); var quantity = parseInt(items[i].substring(position + 1)); if (prodId != "" && quantity > 0) { orderedItems[prodId] = quantity; var sub_total = round((quantity * products[prodId][1]), 2); total += sub_total; termTxt = products[prodId][6]; termTxt = replaceAllStr(termTxt, ' __prc__', products[prodId][1].toFixed(2)); termTxt = replaceAllStr(termTxt, '__pname__', products[prodId][2]); termTxt = replaceAllStr(termTxt, '__prdname__', products[prodId][0]); termTxt = replaceAllStr(termTxt, '__altnm__', products[prodId][5]); term_htm += '' + termTxt + ''; cartHtml += "
" + "
" + "
" + products[prodId][4] + " " + products[prodId][0] + " " + products[prodId][5] + "Quantity: " + quantity +" $" + sub_total.toFixed(2) + "
" + "
" + "" + ""+ "
" + quantity +"
" + "
$" + sub_total.toFixed(2) + "
" + "
$" + sub_total.toFixed(2) + "
" + "
" } } cartHtml += ""; cartHtml += "
" +"
" +"" +"
" +"
" +"
"; +"
"; cartHtml += "
" +"Continue Shopping Empty Cart Checkout
" +"
"; if (cartHtml != "") { $("#cartBox").html(cartHtml); $(".tot-prc").html('$' + total.toFixed(2)); } else { $("#cartBox").html(" Loading..."); } return false; } }; var round = function(value, decimals) { return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals); };