Shopping Cart Issue

Shopping Cart Issue

Hello folks,
I got a little complicated with summing the shoping cart prices.
I have this shopping cart:
I
I wrote this function for updating the basic sum:
  1. function changePrice(divId, sId, price) {
    var x = $("#" + sId).val();
    var y = $("#" + divId).text(x*price + " ₪");
    }



and the HTML form something like that:
  1. <form>
    <select id="selectQuan-1" onChange="changePrice('sum-1','selectQuan-1','678');">
    <option value="0">0</option>
    <option value="1" selected>1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    </select>
    </form>








Now, I'm trying somehow to update the total sum in the div #totalSum. I tried to push the sums of the products into an array.. But I didn't work it out.
Can somebody please help me/lead me to the solution?
thank you very much.