1

In category listing page I am using quick view. In Quick View, product detail page is displayed in popup. In that popup I am displaying wishlist also.

Wishlist functionality is working fine but its output is getting redirected to popup url.

For Quick View I have referred link -

 https://www.weltpixel.com/advance-product-quick-view.html

Wishlist output is getting redirected to popup instead of website url.

 <a href="#" data-post='<?php  echo $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) ?>' class="action towishlist" data-action="add-to-wishlist"><span>Add to Wishlist</span></a>
4
  • You want to redirect on wishlist page or current page? Commented Nov 16, 2017 at 13:43
  • @DhirenVasoya - I want to redirect wishlist output to website url
    – jassi
    Commented Nov 16, 2017 at 16:13
  • Can you explain this is detail, wishlist already available in to website. Commented Nov 17, 2017 at 2:45
  • @DhirenVasoya - I have edited my question
    – jassi
    Commented Nov 17, 2017 at 3:34

1 Answer 1

0

Go to

app/code/WeltPixel/Quickview/view/frontend/templates/product/view/addtocart.phtml

Add this code in your file

<script>
        require([
            'jquery'
        ], function ($) {
            $(function(){
                $('.action.towishlist').on('click',function(event){
                    var  params, action;

                    event.stopPropagation();
                    event.preventDefault();
                    params = $(event.currentTarget).data('post');
                    action = params.action;
                    action += 'product/'+ params.data.product+'/';
                    if (params.data.uenc) {
                        action += 'uenc/' + params.data.uenc;
                    }
                    var FormKey = "<?php echo $FormKey->getFormKey(); ?>";
                    action += '/form_key/'+FormKey;
                    if(window.top.location != window.self.location)
                     {
                        top.window.location.href = action;

                     }
                 });             
            });
        });
    </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.