entropia
10/4/2017 - 12:05 PM

Last Category

Redirect the category of the latest added to cart product. Works when called with a button onClick

getPrevCategory = function () {
	var lastProd = $($('td.cart_product')[$('td.cart_product').length -1]).children('a').attr('href').split('/');
	var lastProdCat = $($('.productCats').children('a:last-child')[$('.productCats').children('a:last-child').length-1]).attr('href').split('/');
	window.location.href = '/'+ lastProdCat[lastProdCat.length-1].split('-').shift()+"-"+ lastProd[3];
}