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

Deduplicate selected cart items.

- Fixes bug with double-counting on Combined search results.
parent 3d38b14e
Branches
Tags
No related merge requests found
...@@ -155,14 +155,15 @@ VuFind.register('cart', function Cart() { ...@@ -155,14 +155,15 @@ VuFind.register('cart', function Cart() {
$("#updateCart, #bottom_updateCart").unbind('click').click(function cartUpdate() { $("#updateCart, #bottom_updateCart").unbind('click').click(function cartUpdate() {
var elId = this.id; var elId = this.id;
var selected = []; var selected = [];
var addToSelected = function processCartFormValues() {
if (-1 === selected.indexOf(this.value)) {
selected.push(this.value);
}
};
var selectedInForm = $form.find('input[name="ids[]"]:checked'); var selectedInForm = $form.find('input[name="ids[]"]:checked');
var selectedFormAttr = $('input[form="' + $form.attr('id') + '"][name="ids[]"]:checked'); var selectedFormAttr = $('input[form="' + $form.attr('id') + '"][name="ids[]"]:checked');
$(selectedInForm).each(function cartFormCheckboxValues() { $(selectedInForm).each(addToSelected);
selected.push(this.value); $(selectedFormAttr).each(addToSelected);
});
$(selectedFormAttr).each(function cartAttrCheckboxValues() {
selected.push(this.value);
});
if (selected.length > 0) { if (selected.length > 0) {
var msg = ""; var msg = "";
var orig = getFullItems(); var orig = getFullItems();
......
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