Remove duplicated rows when looping a HTML table that was added dynamicaly with append()

Remove duplicated rows when looping a HTML table that was added dynamicaly with append()

Hello please can any one helps me to finish this ; I have created this web page for ordering one/more products, now on the topside, when I select a product and its quantity, when I click the " Ajouter" button it goes on the list below, my problem is when I add 2 same products they appears in 2 rows while I just want them in one unique row and then I should ocmbine their quantities. 

the table below is created by an append(), when clicking the "Ajouter" BUTTON, so every element on it,is added dynamicaly, so how can I loop this new table with Jquery, and then remove the duplicated rows without deleting the quantities of every product? 

this is my code :
$("#ajouter").click(function(e){

var productName = $("#products").find(':selected').data('productName');
var productCategoryName = $("#products").find(':selected').data('productCategory');
var quantity = $("#qty").val();

var fields = [];
$('#table .category_1').each(function() {
// MY PROBLEM IS HERE
});
var html = $("<tr><td class='category_1' id='names'>"+productName+
"</td><td class='category_1'>" + productCategoryName +
"</td><td class='category_1'>" +
"<div class='input-group'>"+
"<span class='input-group-btn'>"+
"<button name='btnMin' type='button' class='btn btn-danger btn-number' data-type='minus' data-field='quant[" + index + "]' >"+
"<span class='glyphicon glyphicon-minus' ></span>"+
"</button>"+
"</span>"+
"<input type='text' id='2qt' name='quant[" + index + "]' class='form-control input-number' value='" + quantity + "' min='0' max='100'>"+
"<span class='input-group-btn'>"+
"<button type='button' class='btn btn-success btn-number' data-type='plus' data-field='quant[" + index + "]'>"+
"<span class='glyphicon glyphicon-plus'></span>"+
"</button>"+
"</span>"+
"</div>"+
"</td><td class='category_1'><div class='btn-group btn-group-xs'><a id='btnDelt' data-toggle='tooltip' class='btn btn-default btn-delete' href='javascript:deleteConfirm('product'," +
" ${product.id});'><i class='fa fa-trash-o'></i></a></div></td></tr>");

if (typeof productName === "undefined" || productName == "") {
showGrowl("error", "Veuillez sélectionner un produit")
} else if(typeof quantity === "undefined" || quantity=="0") {
showGrowl("error", "La quantité ne doit pas être 0")
} else {
$('#productsordered').append(html); // MY APPEND IS HERE     }
});