QuickView not working after load product Using infinite scroll Magento 2
-
15-04-2021 - |
Question
I am using Weltpixel Quick View extension and it is working fine.But there is an issue when products loads using infinite scroll.After loads products using infinite scroll , quick view stops working.There is an issue related to the JS function.Can you guys let me know which quick function i have to use in the infinite scroll JS file?
This is my URL: http://45.56.70.30/pospaper/thermal-paper-rolls/all-thermal-paper.html You can check from here.Once the products loads , quick view stops working.
I am using Strategy Infinite Scroll. https://github.com/Strategery-Inc/Magento2-InfiniteScroll This infinite scroll also working fine.
Infintie scroll Js file path:
Weltpixel Quick View JS file
http://45.56.70.30/pospaper/weltpixel_quickview.js
This is the script which used in phtml file.
<script>
requirejs(['jquery', 'weltpixel_quickview' ],
function ($, quickview) {
$(document).ready(function() {
$('.weltpixel-quickview').bind('click', function() {
var prodUrl = $(this).attr('data-quickview-url');
if (prodUrl.length) {
quickview.displayContent(prodUrl);
}
});
});
});
window.weltpixel_quickview = {"baseUrl":"http:\/\/45.56.70.30\/pospaper\/","closeSeconds":"5","showMiniCart":"1","showShoppingCheckoutButtons":"0"};
</script>
Solution
I am also using infinite scroll on category pages and search result page. I have managed to work by changing the following file:
app/code/WeltPixel/Quickview/view/frontend/templates/initialize.phtml
Replacing the whole code with below code:
<?php
// @codingStandardsIgnoreFile
/** @var $block \WeltPixel\Quickview\Block\Initialize */
?>
<script>
requirejs(['jquery', 'weltpixel_quickview' ],
function ($, quickview) {
$(document).ready(function() {
$('#maincontent').on('click', '.weltpixel-quickview', function() {
var prodUrl = $(this).attr('data-quickview-url');
if (prodUrl.length) {
quickview.displayContent(prodUrl);
}
});
});
});
window.weltpixel_quickview = <?php /* @escapeNotVerified */ echo \Zend_Json::encode($block->getConfig()); ?>;
</script>
OTHER TIPS
- First I installed the Scroll.
- After that the Quickview with that changing.