function add_to_cart(id)
{
  var x = window.localStorage.getItem('product_' + id);
  x = x * 1 + 1;
  window.localStorage.setItem('product_' + id, x);
	
}
@@ -19,16 +19,46 @@
 rt(id)%0A%7B
+ %0A  var key = 'product_' + id;
 %0A  var x
@@ -92,44 +92,293 @@
 tem(
-'product_' + id);%0A  x = x * 1 + 1;%0A 
+key);%0A  x = x * 1 + 1;%0A  window.localStorage.setItem(key, x);%0A%7D%0A%0A%0A%0A// calculate count of products in cart%0Afunction cart_get_number_of_items()%0A%7B%0A  var cnt = 0;%0A  for(var i = 0; i %3C window.localStorage.length; i++)%0A  %7B%0A    var key = window.localStorage.key(i); // get key%0A    var value =
  win
@@ -398,36 +398,131 @@
 age.
-s
+g
 etItem(
-'product_' + id, x);%0A%09
+key); // get value%0A    if(key.indexOf('product_') == 0)%0A    %7B%0A      cnt = cnt + value * 1;%0A%0A    %7D%0A  %7D%0A  return cnt;%0A%0A
 %0A%7D

Add cart_get_number_of_items function app.js