Здравствуйте.
PHP код:
<?php
var arr = get_cookie("product").split(",");
var arrres = new Array();
for(var i = 0; i < arr.length; i++){
if(arr[i] != "null"){
arr[i] = arr[i].split("-");
if(arrres[ arr[i][0] ] == 'undefined'){
arrres[ arr[i][0] ] = new Array(arr[i][0],arr[i][1],arr[i][2])
}
else{
arrres[ arr[i][0] ][1] = [ arr[i][0] ][1] + arr[i][1];
}
}
}
Ошибка:
Код:
[04.05.2013 10:53:35] JavaScript - http://test1.ru/catalog/rolls
Event thread: click
Uncaught exception: TypeError: Cannot convert 'arrres[ arr[0] ]' to object
Error thrown at line 34, column 28 in setAddBasketProduct(id, count, price) in http://test1.ru/catalog/rolls:
arrres[ arr[0] ][1] = [ arr[0] ][1] + arr[1];
called from line 1, column 11 in <anonymous function>(event) in http://test1.ru/catalog/rolls:
setAddBasketProduct(2, 1, 500)
И почему-то я не попадаею сперва в блок
PHP код:
<?php
if(arrres[ arr[i][0] ] == 'undefined'){
arrres[ arr[i][0] ] = new Array(arr[i][0],arr[i][1],arr[i][2])
}