Created
December 2, 2009 18:56
-
-
Save foxweb/247440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkRequiredPayments() { | |
$('input.payment_sum_field').each(function() { | |
if ($(this).hasClass("required")) { | |
var tr = $(this).parents("tr"); | |
var checkbox = $("input[type=checkbox]:first", tr); | |
if (!checkbox.attr("checked")) { | |
checkbox.attr("checked", true); | |
} | |
var re = new RegExp("r_([0-9]+)"); | |
var match = re.exec($(this).attr("class")); | |
if (match != null) { | |
var required_sum = match[1]; | |
if ($(this).attr("value") * 1 <= required_sum) { | |
if ($('input.payment_check:checked').length > 0) { | |
$(this).attr("value", required_sum); | |
if ($('input.payment_check:checked').length > 1) { | |
$("div.required_payment:first").removeClass("hidden"); | |
} | |
} | |
else { | |
var total = $("#order_total").html() * 1; | |
$(this).attr("value", total); | |
} | |
} | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment