Jump to content

Add to Cart for wishlist module


owengna

Recommended Posts

Hi,

 

Is there anyway to modify the wishlist module to include add to cart button on products on wishlist?

 

To be honest, the wishlist module doesn't work that well, some of my clients are quite confused with the wishlist module especially the priority and quantity part.

 

Is there any alternatives?

 

 

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...

Hi,

 

Is there anyway to modify the wishlist module to include add to cart button on products on wishlist?

 

To be honest, the wishlist module doesn't work that well, some of my clients are quite confused with the wishlist module especially the priority and quantity part.

 

Is there any alternatives?

 

 

Hi, I got the same feeling.

 

I need to add a button which adds all products from wishlist to cart.

 

Any clue how to do it?

 

 

Thx Mirek

 

Hello.

You need to add the button code in the file themes/your_template/modules/blockwishlist/views/templates/front/managewishlist.tpl at the end of the element ".btn_action":

<a class="exclusive button ajax_add_to_cart_button add-to-cart-in-wl" href="{$link->getPageLink('cart', true, NULL, "qty={$product.quantity|intval}&id_product={$product.id_product|intval}&add")|escape:'html':'UTF-8'}" data-id-attribute="{$product.id_product_attribute}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{$product.quantity|intval}" title="{l s='Add to cart' mod='blockwishlist'}"><span>{l s='Add to cart' mod='blockwishlist'}</span></a>

And you need to change the code in the file themes/your_template/js/modules/blockcart/ajax-cart.js that handles the event "click" on an element ".ajax_add_to_cart_button":

$(document).off('click', '.ajax_add_to_cart_button').on('click', '.ajax_add_to_cart_button', function(e){
	e.preventDefault();
	var idProduct =  parseInt($(this).data('id-product'));
	var idProductAttribute =  parseInt($(this).data('id-product-attribute'));
	var minimalQuantity =  parseInt($(this).data('minimal_quantity'));
	if ($(this).is('.add-to-cart-in-wl')) {
		quan = $(this).closest('.product_infos').find('.wishlist_product_detail input.form-control').val();
		if (quan != minimalQuantity)
			minimalQuantity = quan;
	}
	if (!minimalQuantity)
		minimalQuantity = 1;
	if ($(this).prop('disabled') != 'disabled')
		ajaxCart.add(idProduct, idProductAttribute, false, this, minimalQuantity);
});

For more information (in Russian) can be found here.

post-466565-0-19559100-1442921557_thumb.png

Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...

This tutorial is ok, but I've got problem because combinations are not adding to cart (instead this it takes default combinations). Has anybody similiar problem? Maybe somebody already fix this?

Add to cart link looks like:

 

<a class="exclusive button ajax_add_to_cart_button add-to-cart-in-wl" data-id-attribute="53" data-id-product="9" data-minimal_quantity="1" title="Add to cart" href="http://www.XXXXXXX.eu/cart?qty=1&amp;id_product=4&amp;add="><span>Add to cart</span></a>

 

Prestashop 1.6.19

Edited by tomikk
Something added (see edit history)
Link to comment
Share on other sites

  • 10 months later...

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...