Good morning everyone,
I have a problem with blockwishlist module and i can't find a solution to it.
I read in numerous threads that you have to add blockwishlist to the rightcolumn modules so it can load the ajax-wishlist.js. I have done this and ajax-wishlist.js is successfully loaded. But i have another issue. When i click Add to wishlist i get a javascript error displayed in my console saying:
Uncaught ReferenceError: isLogged is not defined
First i went to my /themes/template/modules/blockwishlist and i renamed the folder so it only loads from /modules/blockwishlist folder. But the error didn't seem to go away. Also i checked if there is a ajax-wishlist.js at /themes/template/js/...*... but there is none.
In the ajax-wishlist.js file there is this code:
$.ajax({
type: 'GET',
url: baseDir + 'modules/blockwishlist/cart.php?rand=' + new Date().getTime(),
headers: { "cache-control": "no-cache" },
async: true,
cache: false,
data: 'action=' + action + '&id_product=' + id_product + '&quantity=' + quantity + '&token=' + static_token + '&id_product_attribute=' + id_product_attribute + '&id_wishlist=' + id_wishlist,
success: function(data)
{
if (action == 'add')
{
if (isLogged == true) {
wishlistProductsIdsAdd(id_product);
wishlistRefreshStatus();
if (!!$.prototype.fancybox)
$.fancybox.open([
{
type: 'inline',
autoScale: true,
minHeight: 30,
content: '<p class="fancybox-error">' + added_to_wishlist + '</p>'
}
], {
padding: 0
});
else
alert(added_to_wishlist);
}
else
{
if (!!$.prototype.fancybox)
$.fancybox.open([
{
type: 'inline',
autoScale: true,
minHeight: 30,
content: '<p class="fancybox-error">' + loggin_required + '</p>'
}
], {
padding: 0
});
else
alert(loggin_required);
}
}
if (action == 'delete') {
wishlistProductsIdsRemove(id_product);
wishlistRefreshStatus();
}
if($('#' + id).length != 0)
{
$('#' + id).slideUp('normal');
document.getElementById(id).innerHTML = data;
$('#' + id).slideDown('normal');
}
}
});
So i went before the if (isLogged == true) and added
var isLogged = true;
Then everything worked fine.
So my question is how can i fix this?
How can i declare this variable correctly, so that the JS knows if a user is logged in or no?
PS I have updated blockwishlist module to latest version
Information:
http://exxesfashion.com/en/earings/1325-earings-code-9921.html
Prestashop Version: 1.6.0.6