Skip to content
Snippets Groups Projects
Commit 2a82d744 authored by Demian Katz's avatar Demian Katz
Browse files

Fixed confusing variable naming in "add to cart" closure; increased efficiency...

Fixed confusing variable naming in "add to cart" closure; increased efficiency by leaving the function as soon as a duplicate is found.
parent 0d0f20fd
Branches
Tags instance/local/staging/20210419
No related merge requests found
/*global vufindString*/
var _CART_COOKIE = 'vufind_cart';
var _CART_COOKIE_SOURCES = 'vufind_cart_src';
var _CART_COOKIE_DELIM = "\t";
......@@ -17,9 +19,10 @@ function registerUpdateCart($form) {
var msg = "";
var orig = getItemsFromCartCookie();
$(selected).each(function(i) {
for (i in orig) {
if (this == orig[i]) {
for (var x in orig) {
if (this == orig[x]) {
inCart++;
return;
}
}
addItemToCartCookie(this);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment