Question

Do you know if it's possible to add a PayPal button on the popup that appears when we add a product from Quickview?

Quickview :

enter image description here

Popup :

enter image description here

Thanks,

Was it helpful?

Solution

You need to put the following code into your phtml file which you used to show pop-up.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$baseurl = $storeManager->getStore()->getBaseUrl();
$paypalexpress = $baseurl.'paypal/express/start/button/1/';

Now for the button using below html.

<div id="button">
    <a href="<?php echo $paypalexpress; ?>">
    <img id="btnPayPal" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif">
    </a>
</div>

OTHER TIPS

Thanks, Dhiren

Do you know how to manage the popup in the Weltpixel Quickview module?

I found this file :

app/code/WeltPixel/Quickview/view/frontend/web/js/weltpixel_quickview.js

define([
'jquery',
'magnificPopup'
], function ($, magnificPopup) {
"use strict";

return {
    displayContent: function(prodUrl) {
        if (!prodUrl.length) {
            return false;
        }

        var url = window.weltpixel_quickview.baseUrl + 'weltpixel_quickview/index/updatecart';
        var showMiniCart = parseInt(window.weltpixel_quickview.showMiniCart);

        window.weltpixel_quickview.showMiniCartFlag = false;

        $.magnificPopup.open({
            items: {
              src: prodUrl
            },
            type: 'iframe',
            closeOnBgClick: false,
            preloader: true,
            tLoading: '',
            callbacks: {
                open: function() {
                  $('.mfp-preloader').css('display', 'block');
                },
                beforeClose: function() {
                    $('[data-block="minicart"]').trigger('contentLoading');
                    $.ajax({
                    url: url,
                    method: "POST"
                  });
                },
                close: function() {
                  $('.mfp-preloader').css('display', 'none');
                },
                afterClose: function() {
                    /* Show only if product was added to cart and enabled from admin */
                    if (window.weltpixel_quickview.showMiniCartFlag && showMiniCart) {
                        $("html, body").animate({ scrollTop: 0 }, "slow");
                        setTimeout(function(){
                            $('.action.showcart').trigger('click');
                        }, 1000);
                    }
                }
              }
        });
    }
};

Thanks in advance

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top