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>
  • You want to redirect on wishlist page or current page? – Dhiren Vasoya Nov 16 '17 at 13:43
  • @DhirenVasoya - I want to redirect wishlist output to website url – jassi Nov 16 '17 at 16:13
  • Can you explain this is detail, wishlist already available in to website. – Dhiren Vasoya Nov 17 '17 at 2:45
  • @DhirenVasoya - I have edited my question – jassi Nov 17 '17 at 3:34
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, privacy policy and cookie policy

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