you would need to use a javascript function on the onClick event of the add to cart button.
this example assumes that:
1: the cart object is named "eCart1"
2: the add to cart button form is named "eCart1_1_ATC_1"
3: the quantity element is named "eCart1_1_Quantity_Add"
you will need to make modifications to the javascript if your code uses different names
the on click event for the button would be:
onClick="return if13(<?php echo $eCart1->TotalColumn("Quantity"); ?>,document.eCart1_1_ATC_1.eCart1_1_Quantity_Add.value);"
the javascript function would look like:
<script type="text/javascript">
function if13(alreadyIn, qtyAdded) {
//alert(parseInt(alreadyIn)+parseInt(qtyAdded));
if(parseInt(alreadyIn)+parseInt(qtyAdded) == 13) {
alert('no');
return false;
}
}
</script>
keep in mind that this is really not something that is supported in eCart and we will not be able to offer extensive support for it