var products = []; products[211] = ["Foldable Dog Water Bottle", 9.96, "Pro Pet Selection", "Crafted with a detachable body of robust, food-grade polycarbonate (PC), this pet water bottle may help make cleaning a breeze as it's dishwasher safe. The filter element, made from natural crushed coconut shells, is designed with your pet's safety and the environment in mind. Upon first use, the appearance of black powder foam may occur, which is normal. Pre-soaking the filter before its first use may help ensure it works optimally.", "", "X 1", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Foldable Dog Water Bottle", 14.96, "Pro Pet Selection", "", "", "X 2", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Foldable Dog Water Bottle", 29.96, "Pro Pet Selection", "", "", "X 4", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Dog Paw Washer", 19.96, "Pro Pet Selection", "This dog paw cleaner is designed to provide a comfortable and secure cleaning experience. Its soft yet durable brushes may help to clean your dog's paws without causing harm, and the secure lid may help prevent spills. Simply add water, insert each paw, rotate, and repeat. Keeping it ready may help with quick and easy cleanup after any muddy outing.", "", "X 1", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Round Bed With Soft Cushion", 49.96, "Pro Pet Selection", "This round pet bed is crafted with long, soft plush all around, which may help create a wonderfully fluffy and gentle surface for your cat or dog to sink into. The deep crevices may help provide a sense of security, allowing your pet to burrow and feel protected, much like they would on a soft bed or sofa. This feeling of safety may help encourage full, restful sleep, which is essential for improved behavior and better health. It's an ideal pet cave for pets who cherish a cozy and secure space.", "", "X 1", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Round Bed With Soft Cushion", 79.96, "Pro Pet Selection", "", "", "X 2", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Round Bed With Soft Cushion", 97.96, "Pro Pet Selection", "", "", "X 3", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Round Bed With Soft Cushion", 119.92, "Pro Pet Selection", "", "", "X 4", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Automatic Cat Feeder", 39.96, "Pro Pet Selection", "This smart automatic pet feeder features a press-to-lock lid and a control panel cover, which may help prevent overeating and accidental setting changes by curious paws or persistent food bandits. Enjoy the convenience of dual power: D Cell alkaline batteries may help offer up to 180 days of placement freedom, or you can plug into a wall outlet. This feeder may help you say goodbye to accidental schedule disruptions!", "", "X 1", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Automatic Cat Feeder", 69.96, "Pro Pet Selection", "", "", "X 2", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Automatic Cat Feeder", 159.96, "Pro Pet Selection", "", "", "X 5", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Pet Clipper Grooming Kit", 44.88, "Pro Pet Selection", "This multi-functional dog grooming kit is designed to be your all-in-one solution for at-home care. Its upgraded vacuuming function may help collect up to 99% of loose hair, aiming to keep your home spotless during grooming. With an extra-large 2.5-liter capacity and a new triple filtration system, you may find you can groom more and empty less, even when tackling thick coats. This kit may help reduce the hassle of flying fur, leading to a cleaner and happier grooming experience for both you and your dog.", "", "X 1", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Pet Clipper Grooming Kit", 139.92, "Pro Pet Selection", "", "", "X 3", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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] = ["Pet Clipper Grooming Kit", 199.84, "Pro Pet Selection", "", "", "X 5", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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[225] = ["Pet Clipper Grooming Kit", 239.76, "Pro Pet Selection", "", "", "X 6", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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[226] = ["Dog Litter Box", 59.96, "Pro Pet Selection", "An indoor dog litter box may help simplify potty training for puppies and small to medium dogs. The four-wall design with a sloping edge may help contain spray and prevent leaks when used with standard pee pads. Easy to assemble, the base and walls snap together to create a designated bathroom spot indoors. The tray is designed to fit standard-sized pads, and an optional grass turf layer is included. Regular cleaning may help reduce odors and maintain freshness.", "", "X 1", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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[227] = ["Dog Litter Box", 179.88, "Pro Pet Selection", "This multi-functional dog grooming kit is designed to be your all-in-one solution for at-home care. Its upgraded vacuuming function may help collect up to 99% of loose hair, aiming to keep your home spotless during grooming. With an extra-large 2.5-liter capacity and a new triple filtration system, you may find you can groom more and empty less, even when tackling thick coats. This kit may help reduce the hassle of flying fur, leading to a cleaner and happier grooming experience for both you and your dog.", "", "X 3", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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[228] = ["Dog Litter Box", 249.8, "Pro Pet Selection", "This multi-functional dog grooming kit is designed to be your all-in-one solution for at-home care. Its upgraded vacuuming function may help collect up to 99% of loose hair, aiming to keep your home spotless during grooming. With an extra-large 2.5-liter capacity and a new triple filtration system, you may find you can groom more and empty less, even when tackling thick coats. This kit may help reduce the hassle of flying fur, leading to a cleaner and happier grooming experience for both you and your dog.", "", "X 5", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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[229] = ["Dog Litter Box", 299.76, "Pro Pet Selection", "This multi-functional dog grooming kit is designed to be your all-in-one solution for at-home care. Its upgraded vacuuming function may help collect up to 99% of loose hair, aiming to keep your home spotless during grooming. With an extra-large 2.5-liter capacity and a new triple filtration system, you may find you can groom more and empty less, even when tackling thick coats. This kit may help reduce the hassle of flying fur, leading to a cleaner and happier grooming experience for both you and your dog.", "", "X 6", "By clicking the Order Now 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-306-0147 or e-mailing support@propetselection.com. Charges will appear on my credit card statements as propetselection. 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 = 100; 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(); } $.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(); }); } $('.trm_1').hide(); 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); //console.log('showFullCart'); //console.log(showFullCart); 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; 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] + " "+ quantity +"

" + "
" + "

" + products[prodId][0] + "

" + "

Qty: " + products[prodId][5] + "

" + "

$" + sub_total.toFixed(2) + "

" + "
" + "
" + "" + ""+ "
"+ quantity +"
" + "
$" + (products[prodId][1]).toFixed(2) + "
" + "
" } } cartHtml += "
"; cartHtml += "
" +"
" +"
    " +"
  • Sub Total: $" + total.toFixed(2) + "
  • " +"
  • Shipping & Handling: $0.00
  • " +"
  • Total: $" + total.toFixed(2) + "
  • " +"
" +"
" +"
"; cartHtml += "
" if (cartHtml != "") { $("#cartBox").html(cartHtml); $(".cart-box").html(cartHtml); $(".trm_1").html(term_htm); $(".tot-prc").html('$' + total.toFixed(2)); } else { $("#cartBox").html(" Loading..."); $(".cart-box").html('You have not selected any product... '); } return false; } }; var round = function(value, decimals) { return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals); };