"Out of the box" wish list will add a button to the product info page. The button has value of "yes". In the wishlist_cart_actions.php file there is test on $_GET for 'cart_add' testing for the value of "yes".
In a nutshell, here's the solution. Remove the button from the product info page and replace with a checkbox that if checked will have the value of "yes". Then hide the checkbox. Put up some text (likely "Add to Wishlist") that when clicked will "behind the scene" check the hidden check box and also submit the cart_add form. I did this with JS/Jquery...
PHP Code:
<div style="cursor: pointer;" id="productWishlistLink" class="pi-tell-ask-add biggerText">
<span>Add to Wish list</span>
<noscript><span class="smallerText">Check the box then click add to cart. Or enable javascript and reload the page!</span></noscript>
<input style="display: none;" name="wishlist" value="yes" id="pInfoWishCheckbox" type="checkbox"> </div>
Then the JS that makes it all work...
Code:
$(document).ready(function() {
$('#productWishlistLink').css('cursor', 'pointer');
$("input#pInfoWishCheckbox").css('display', 'none');
});
$(document).on('click', '#productWishlistLink span', function(){
$("input#pInfoWishCheckbox").prop('checked', true);
if($("input[name='wishlist']").is(':checked')){
$('form[name=cart_quantity]').submit();
}
});
Bookmarks