While customizing my site, I have made numerous changes and it looks like I messed up somewhere but I can't what went wrong. I would much appreciate any help here.
Here is what's happening, before logging in to my account (as a customer) I can add products into my cart without any problem. However, once I login then every-time I try to add a NEW product into the cart I get an error message
SyntaxError: Unexpected token <
or
SyntaxError: Unexpected token <
/ext/posc_ajxcart/js/posc_ajxcart_functions.js:91:43 Object.error()
ext/jquery/jquery.js:2:27449 i()
ext/jquery/jquery.js:2:28213 Object.fireWith as rejectWith
ext/jquery/jquery.js:4:22746 y()
ext/jquery/jquery.js:4:26925 XMLHttpRequest.c()
and even though I get the error message the product is added to the cart. After I refresh the page, and since that product is already in the cart, the error goes away and I can add more of the same product to the cart.
So any product that is not yet in the cart will return this error the first time it is added to the cart, and again this happens only if I'm logged in as a customer.
and the above /ext/posc_ajxcart/js/posc_ajxcart_functions.js:91:43 Object.error()
refers to:
var err = eval("(" + xhr.responseText + ")");
Here is the code and thank you in advance.
function poscExtraBtnLink($products_lst){
if (POSC_AJXCART_STATUS == 'True') {
$products_id = $products_lst['products_id'];
if(tep_has_product_attributes($products_id)==1){
return 'onclick="setPoscShowOptions(this, \''.$products_id.'\', \''.tep_href_link(FILENAME_DEFINE_POSC_AJXCART,'products_id='.$products_id).'\'); return false;"';
}else{
return 'onclick="setPoscAjxAddCart(this, \''.$products_id.'\'); return false;"';
}
}
return false;
}
//set AjxAddtoCart
function setPoscAjxAddCart(e, products_id, action, qty, d, t){
var action = action || 'add';
var qty = qty || '1';
setPoscAjxloaderClass(e, 'add', t);
try {
jQuery.ajax({
type : 'POST',
url : posc_ajxcart_file,
dataType : 'json',
data : (((typeof d!="undefined") && d!='')? d:{'posc_action': action,'products_id': products_id, 'qty': qty}),
success :function(data){
setPoscAjxData(e, data, action);
setPoscAjxloaderClass(e, 'remove', t);
},
error: function(xhr, textStatus, errorThrown) {
var err = eval("(" + xhr.responseText + ")");
setPoscAjxQck(e, "Error: " + xhr.status + ": " + xhr.statusText);
setPoscAjxloaderClass(e, 'remove', t);
}
});
} catch (e) {
}
return false;
}