Jump to content

Wishlist problem with ajax product image refresh


Recommended Posts

(PS 1.4.8.2)


Hi,


I managed to add product image to my block whishlist in header/top of the page (it slides down/up with a click, like the log/sign in at Prestashop site).


The problem is that the images (path) get broken when i switch from wishlists in the drop-down list. If i refresh the page, it's ok. It seems that the ajax part is not working and the images are not refreshed...


The correct path is /img/p/21-118-small.jpg (ok when i refresh the page or when the product is added). After i change wishlists in the drop-down list, the image is broken and the path changes to /img/p/1/1/8/118-small.jpg.


In Chrome's console, i get this error:



WishlistChangeDefault.$.ajax.success ajax-wishlist.js:85

and the piece of code in the ajax-whishlist.js file and the line 85 in the WishlistChangeDefault function:



function WishlistChangeDefault(id, id_wishlist)
{
$.ajax({
type: 'GET',
url: baseDir + 'modules/blockwishlist/cart.php',
async: true,
data: 'id_wishlist=' + id_wishlist + '&token=' + static_token,
cache: false,
success: function(data)
{
$('#' + id).slideUp('normal');
document.getElementById(id).innerHTML = data;
$('#' + id).slideDown('normal');
}
});
}

The line 85 in the function:



document.getElementById(id).innerHTML = data;

I tried to follow the blockcart structure (which i also managed to add product images and solved the ajax issue) but it's diferent (easier, imo).


I guess something is missing in the cart.php (or somewhere else for sure) file of the block wishlist.


Can anyone help me how to figure out this? Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...