Commit 74f3d846 by lmf

Merge branch 'developer' of http://47.99.244.21:9999/root/joshine into developer

parents 68b3ed21 6d338657
<?php
/**
* Class View
*
* PHP version 7
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
namespace Sparsh\QuickView\Controller\Catalog\Product;
use Magento\Framework\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
/**
* Class View
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
class View extends \Magento\Catalog\Controller\Product
{
/**
* @var \Magento\Catalog\Helper\Product\View
*/
public $viewHelper;
/**
* @var \Magento\Framework\Controller\Result\ForwardFactory
*/
public $resultForwardFactory;
/**
* @var PageFactory
*/
public $resultPageFactory;
/**
* @var
*/
public $template;
/**
* @var \Magento\Framework\Json\Helper\Data
*/
public $data;
/**
* View constructor.
* @param Context $context
* @param \Magento\Catalog\Helper\Product\View $viewHelper
* @param \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory
* @param \Magento\Framework\Json\Helper\Data $data
* @param PageFactory $resultPageFactory
*/
public function __construct(
Context $context,
\Magento\Catalog\Helper\Product\View $viewHelper,
\Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory,
\Magento\Framework\Json\Helper\Data $data,
PageFactory $resultPageFactory
) {
$this->viewHelper = $viewHelper;
$this->resultForwardFactory = $resultForwardFactory;
$this->resultPageFactory = $resultPageFactory;
$this->data = $data;
parent::__construct($context);
}
/**
* Excecute for View Action
*
* @return \Magento\Framework\Controller\Result\ForwardFactory
*/
public function execute()
{
$categoryId = (int) $this->getRequest()->getParam('category', false);
$productId = (int) $this->getRequest()->getParam('id');
$specifyOptions = $this->getRequest()->getParam('options');
if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED)) {
$product = $this->_initProduct();
if (!$product) {
return $this->noProductRedirect();
}
if ($specifyOptions) {
$notice = $product->getTypeInstance()->getSpecifyOptionMessage();
$this->messageManager->addNotice($notice);
}
if ($this->getRequest()->isAjax()) {
$this->getResponse()->representJson(
$this->data->get()->jsonEncode(
[
'backUrl' => $this->_redirect->getRedirectUrl()
]
)
);
return;
}
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setRefererOrBaseUrl();
return $resultRedirect;
}
$params = new \Magento\Framework\DataObject();
$params->setCategoryId($categoryId);
$params->setSpecifyOptions($specifyOptions);
try {
$page = $this->resultPageFactory->create(
false,
[
'isIsolated' => true,
'template' => 'Sparsh_QuickView::product_template.phtml'
]
);
$page->addDefaultHandle();
$page->getLayout()->getUpdate()->addHandle('catalog_product_view');
$page->getLayout()->getUpdate()->addHandle('quickview_catalog_product_view');
$this->viewHelper->prepareAndRender($page, $productId, $this, $params);
return $page;
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
return $this->noProductRedirect();
} catch (\Exception $e) {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
}
/**
* Redirect for no product
*
* @return \Magento\Framework\Controller\Result\ForwardFactory
*/
public function noProductRedirect()
{
$store = $this->getRequest()->getQuery('store');
if (isset($store) && !$this->getResponse()->isRedirect()) {
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setPath('');
} elseif (!$this->getResponse()->isRedirect()) {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');
return $resultForward;
}
}
}
<?php
/**
* Class Data
*
* PHP version 7
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
namespace Sparsh\QuickView\Helper;
/**
* Class Data
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
* Return config value
*
* @param string $configPath configPath
*
* @return mixed
*/
public function getConfig($configPath)
{
return $this->scopeConfig->getValue(
$configPath,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
}
<?php
/**
* Class Compare
*
* PHP version 7
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
namespace Sparsh\QuickView\Plugin;
use Magento\Framework\Exception\NoSuchEntityException;
/**
* Class Compare
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
class Compare
{
/**
* Compare constructor.
* @param \Magento\Framework\App\Response\RedirectInterface $redirect
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
* @param \Magento\Framework\App\RequestInterface $request
*/
public function __construct(
\Magento\Framework\App\Response\RedirectInterface $redirect,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
\Magento\Framework\App\RequestInterface $request
) {
$this->redirect = $redirect;
$this->resultJsonFactory = $resultJsonFactory;
$this->productRepository = $productRepository;
$this->request = $request;
}
/**
* @param \Magento\Catalog\Controller\Product\Compare\Add $subject
* @param \Closure $proceed
* @return \Magento\Framework\Controller\Result\Json|mixed
*/
public function aroundExecute(
\Magento\Catalog\Controller\Product\Compare\Add $subject,
\Closure $proceed
) {
$resultProceed = $proceed();
$requestParams = $this->request->getParams();
$productId = isset($requestParams['product']) ? (int)$requestParams['product'] : null;
if (!$productId) {
return $resultProceed;
}
try {
$product = $this->productRepository->getById($productId);
} catch (NoSuchEntityException $e) {
$product = null;
}
if ($product && $product->isSalable()) {
if (strpos($this->redirect->getRefererUrl(), 'quickview') !== false) {
$result = $this->resultJsonFactory->create();
$response = [
'success' => 'true',
'message' => 'You added product '. $product->getName() .' to the Comparison List.'
];
return $result->setData($response);
}
}
return $resultProceed;
}
}
<?php
/**
* Class Wishlist
*
* PHP version 7
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
namespace Sparsh\QuickView\Plugin;
use Magento\Framework\Exception\NoSuchEntityException;
/**
* Class Wishlist
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
class Wishlist
{
/**
* Wishlist constructor.
* @param \Magento\Framework\App\Response\RedirectInterface $redirect
* @param \Magento\Framework\UrlInterface $urlInterface
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
* @param \Magento\Framework\App\RequestInterface $request
*/
public function __construct(
\Magento\Framework\App\Response\RedirectInterface $redirect,
\Magento\Framework\UrlInterface $urlInterface,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
\Magento\Framework\App\RequestInterface $request
) {
$this->redirect = $redirect;
$this->urlInterface = $urlInterface;
$this->resultJsonFactory = $resultJsonFactory;
$this->productRepository = $productRepository;
$this->request = $request;
}
/**
* @param \Magento\Wishlist\Controller\Index\Add $subject
* @param \Closure $proceed
* @return \Magento\Framework\Controller\Result\Json|mixed
*/
public function aroundExecute(\Magento\Wishlist\Controller\Index\Add $subject, \Closure $proceed)
{
$resultProceed = $proceed();
$requestParams = $this->request->getParams();
$productId = isset($requestParams['product']) ? (int)$requestParams['product'] : null;
if (!$productId) {
return $resultProceed;
}
try {
$product = $this->productRepository->getById($productId);
} catch (NoSuchEntityException $e) {
$product = null;
}
if (strpos($this->redirect->getRefererUrl(), 'quickview') !== false) {
if (strpos($this->urlInterface->getCurrentUrl(), 'loginPost') !== false ||
strpos($this->urlInterface->getCurrentUrl(), 'createpost') !== false) {
return $resultProceed;
}
$result = $this->resultJsonFactory->create();
$response = [
'success' => 'true',
'message' => $product->getName() . ' has been added to your Wish List.'
];
return $result->setData($response);
} else {
return $resultProceed;
}
}
}
#Quick View Module
This extension brings a convenient experience to the customers by allowing a single click to get the product info and add to the cart immediately without any need of the loading page for product detail and come back and forth.
##Support:
version - 2.3.x, 2.4.x
##How to install Extension
1. Download the archive file.
2. Unzip the file
3. Create a folder [Magento_Root]/app/code/Sparsh/QuickView
4. Drop/move the unzipped files to directory '[Magento_Root]/app/code/Sparsh/QuickView'
#Enable Extension:
- php bin/magento module:enable Sparsh_QuickView
- php bin/magento setup:upgrade
- php bin/magento setup:di:compile
- php bin/magento setup:static-content:deploy
- php bin/magento cache:flush
#Disable Extension:
- php bin/magento module:disable Sparsh_QuickView
- php bin/magento setup:upgrade
- php bin/magento setup:di:compile
- php bin/magento setup:static-content:deploy
- php bin/magento cache:flush
\ No newline at end of file
{
"name": "sparsh/quick-view-magento-2-extension",
"description": "Sparsh Product Quick View Extension for Magento 2",
"type": "magento2-module",
"version": "1.3.0",
"license": "OSL-3.0",
"require": {
"php": "~7.1.0|~7.2.0|~7.3.0|~7.4.0|^8.0"
},
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Sparsh\\QuickView\\": ""
}
}
}
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Sparsh_QuickView::config_quick_view" title="Quick View Setting" translate="title" sortOrder="80" />
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="sparsh" translate="label" sortOrder="500">
<label>Sparsh Extensions</label>
</tab>
<section id="sparsh_quick_view" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Add To Cart</label>
<!-- Assign section to tab -->
<tab>sparsh</tab>
<resource>Sparsh_QuickView::config_quick_view</resource>
<!-- create group for fields in section -->
<group id="general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>General Configuration</label>
<!-- create text type field -->
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Quick View Button</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
</section>
</system>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<sparsh_quick_view>
<general>
<enable>1</enable>
</general>
</sparsh_quick_view>
</default>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="\Magento\Wishlist\Controller\Index\Add">
<plugin name="sparsh_quick_view_wishlist" type="Sparsh\QuickView\Plugin\Wishlist"/>
</type>
<type name="\Magento\Catalog\Controller\Product\Compare\Add">
<plugin name="sparsh_quick_view_compare" type="Sparsh\QuickView\Plugin\Compare"/>
</type>
</config>
\ No newline at end of file
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route frontName="quickview" id="quickview">
<module name="Sparsh_QuickView"/>
</route>
</router>
</config>
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Sparsh_QuickView" setup_version="1.3.0">
<sequence>
<module name="Magento_CatalogWidget" />
<module name="Magento_Wishlist" />
<module name="Magento_CatalogSearch" />
<module name="Magento_Cms" />
</sequence>
</module>
</config>
<?php
/**
* Sparsh QuickView Extension
*
* PHP version 7
*
* @category Sparsh
* @package Sparsh_QuickView
* @author Sparsh <magento@sparsh-technologies.com>
* @license https://www.sparsh-technologies.com Open Software License (OSL 3.0)
* @link https://www.sparsh-technologies.com
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Sparsh_QuickView',
__DIR__
);
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="mage/gallery/gallery.css"/>
<css src="Sparsh_QuickView::css/quickview.css" />
</head>
<body>
<referenceContainer name="before.body.end">
<block class="Magento\Framework\View\Element\Template" name="sparsh.quickview.initialize"
template="Sparsh_QuickView::initialize.phtml"/>
</referenceContainer>
</body>
</page>
\ No newline at end of file
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="empty"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="sparsh.free-shipping.bar.top" remove="true" />
<referenceBlock name="header.container" remove="true" />
<referenceBlock name="page.top" remove="true" />
<referenceBlock name="footer-container" remove="true" />
<referenceBlock name="copyright" remove="true"/>
<referenceBlock name="catalog.product.related" remove="true"/>
<referenceBlock name="product.info.upsell" remove="true"/>
<referenceBlock name="product.info.review" remove="true" />
<referenceBlock name="reviews.tab" remove="true" />
<referenceBlock name="form.subscribe" remove="true" />
</body>
</page>
\ No newline at end of file
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_product_view_type_bundle"/>
</page>
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<attribute name="class" value="page-product-configurable"/>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="configurableproduct_product_view_head_components" template="Magento_ConfigurableProduct::js/components.phtml"/>
</referenceBlock>
<referenceContainer name="product.info.type">
<block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name="product.info.configurable" as="product_type_data" template="Magento_Catalog::product/view/type/default.phtml"/>
<container name="product.info.configurable.extra" after="product.info.configurable" as="product_type_data_extra" label="Product Extra Info">
<block class="Magento\ConfigurableProduct\Block\Stockqty\Type\Configurable" template="Magento_CatalogInventory::stockqty/composite.phtml"/>
</container>
</referenceContainer>
<referenceBlock name="product.info.options.wrapper">
<block class="Magento\Swatches\Block\Product\Renderer\Configurable" name="product.info.options.swatches"
as="swatch_options" before="-">
<arguments>
<argument name="configurable_view_model"
xsi:type="object">Magento\Swatches\ViewModel\Product\Renderer\Configurable</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_product_view_type_downloadable"/>
</page>
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_product_view_type_grouped"/>
</page>
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_product_view_type_simple" />
</page>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_product_view_type_virtual" />
</page>
var config = {
map: {
'*': {
magnificPopup: 'Sparsh_QuickView/js/lib/jquery.magnific-popup',
quickView: 'Sparsh_QuickView/js/quickview',
compare: 'Sparsh_QuickView/js/compare',
ajaxWishlist: 'Sparsh_QuickView/js/wishlist'
}
},
shim: {
magnificPopup: {
deps: ['jquery']
}
}
};
<?php /** @var \Magento\Framework\View\Element\Template $block */?>
<?php
$helper = $this->helper(\Sparsh\QuickView\Helper\Data::class);
$isActive = $helper->getConfig('sparsh_quick_view/general/enable');
if ($isActive == 1): ?>
<script type="text/x-magento-init">
{
"*": {
"quickView": { "baseUrl": "<?= /* @noEscape */ $block->getBaseUrl() ?>" },
"compare":{},
"ajaxWishlist":{
"loginUrl":"<?= /* @noEscape */ $block->getUrl('customer/account/login'); ?>"
}
}
}
</script>
<?php endif; ?>
<script>
var sparsh_mfp_wrap = document.getElementsByClassName('sparsh-mfp-wrap');
sparsh_mfp_wrap[0].removeAttribute("style");
</script>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?><?= /* @noEscape */ $layoutContent; ?>
define(
[
'jquery'
], function ($) {
'use strict';
$.widget(
'sparsh.compare', {
_create: function () {
this.action();
},
action: function () {
var self = this;
$('#sparsh-mfp-quickview').delegate(
'.action.tocompare', 'click', function (e) {
console.log(e);
var element = $(this),
dataPost = element.data('post'),
key = $('input[name="form_key"]').val();
if (key) {
dataPost.data.form_key = key;
}
var parameter = $.param(dataPost.data),
url = dataPost.action + (parameter.length ? '?' + parameter : '');
e.stopPropagation();
$.ajax(
{
url: url,
type: 'post',
dataType: 'json',
showLoader: true,
success: function (res) {
var popup = $('#sparsh-mfp-quickview');
$('.sparsh-mfp-quickview-message').addClass('message-success success message').html('<div>' + res.message + '</div>');
popup.animate({scrollTop: 0}, "slow");
var checkExist = setInterval(function () {
alert('save success');
if ($('div.page.messages').find('.message-success').length) {
clearInterval(checkExist);
$('div.page.messages').find('.message-success').remove();
}
}, 50);
}
}
);
}
);
}
}
);
return $.sparsh.compare;
}
);
define(
[
'jquery',
'mage/translate',
'mage/url',
'magnificPopup'
], function ($, $t, url) {
"use strict";
$.widget(
'sparsh.QuickView', {
options: {
baseUrl: '/',
popupTitle: $t('Add To Cart'),
itemClass: '.products.list .item.product-item, .widget-product-grid .product-item, .add-product-shop-car',
btnLabel: $t('Add To Cart'),
btnContainer: '.product-item-info',
handlerClassName: 'sparsh-quick-view-button',
defaultClassName: 'action primary'
},
_create: function () {
if (!$('body').hasClass('catalog-product-view')) {
this._initialButtons(this.options);
this._bindPopup(this.options);
}
},
_initialButtons: function (config) {
$(config.itemClass).each(function () {
if (!$(this).find('.' + config.handlerClassName).length) {
var groupName = $(this).parent().attr('class').replace(' ', '-');
var productId = $(this).find('.price-final_price').data('product-id');
if (typeof productId !== 'undefined' && productId !== undefined && productId !== null) {
var url = config.baseUrl + 'quickview/catalog_product/view/id/' + productId;
var btnQuickView = '<div class="sparsh-quick-view-btn-container">';
btnQuickView += '<a rel="' + groupName + '" class="' + config.defaultClassName + ' ' + config.handlerClassName + ' sparsh-quick-view-button-pc" href="' + url + '"';
btnQuickView += ' title="' + config.popupTitle + '"';
btnQuickView += ' >';
btnQuickView += '<svg t="1677035083997" class="quick-view-icon-view" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3700"><path d="M987.52 367.36c-108.16-146.56-266.88-239.36-444.16-239.36-177.28 0-335.36 92.8-444.16 239.36-48 64.64-48 160.64 0 225.28C208 739.2 366.72 832 543.36 832c177.28 0 335.36-92.8 444.16-239.36C1035.52 528 1035.52 432 987.52 367.36zM939.52 539.52C839.04 684.8 694.4 768 542.72 768c-151.68 0-296.32-83.2-396.8-228.48C121.6 505.6 121.6 455.04 145.92 420.48 246.4 275.2 391.04 192 542.72 192c151.68 0 296.32 83.2 396.8 228.48C963.2 455.04 963.2 505.6 939.52 539.52zM544 256C420.48 256 320 356.48 320 480S420.48 704 544 704 768 603.52 768 480 667.52 256 544 256zM544 640C455.68 640 384 568.32 384 480S455.68 320 544 320C632.32 320 704 391.68 704 480S632.32 640 544 640z" p-id="3701" fill="#ffffff"></path></svg><span>' + config.btnLabel + '</span></a>';
btnQuickView += '<a rel="' + groupName + '" class="' + config.defaultClassName + ' ' + config.handlerClassName + ' sparsh-quick-view-button-phone " id="sparsh-quick-view-button-phone" href="' + url + '"';
btnQuickView += ' title="' + config.popupTitle + '"';
btnQuickView += ' >';
btnQuickView += '<svg t="1677047956598" class="quick-view-icon-shop-car" viewBox="0 0 1028 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5146" ><path d="M332.8 790.528q19.456 0 36.864 7.168t30.208 19.968 20.48 30.208 7.68 36.864-7.68 36.864-20.48 30.208-30.208 20.48-36.864 7.68q-20.48 0-37.888-7.68t-30.208-20.48-20.48-30.208-7.68-36.864 7.68-36.864 20.48-30.208 30.208-19.968 37.888-7.168zM758.784 792.576q19.456 0 37.376 7.168t30.72 19.968 20.48 30.208 7.68 36.864-7.68 36.864-20.48 30.208-30.72 20.48-37.376 7.68-36.864-7.68-30.208-20.48-20.48-30.208-7.68-36.864 7.68-36.864 20.48-30.208 30.208-19.968 36.864-7.168zM930.816 210.944q28.672 0 44.544 7.68t22.528 18.944 6.144 24.064-3.584 22.016-13.312 37.888-22.016 62.976-23.552 68.096-18.944 53.248q-13.312 40.96-33.28 56.832t-49.664 15.872l-35.84 0-65.536 0-86.016 0-96.256 0-253.952 0 14.336 92.16 517.12 0q49.152 0 49.152 41.984 0 20.48-9.728 35.84t-38.4 14.336l-49.152 0-94.208 0-118.784 0-119.808 0-99.328 0-55.296 0q-20.48 0-34.304-9.216t-23.04-24.064-14.848-32.256-8.704-32.768q-1.024-6.144-5.632-29.696t-11.264-58.88-14.848-78.848-16.384-87.552q-19.456-103.424-44.032-230.4l-76.8 0q-15.36 0-25.6-7.68t-16.896-18.432-9.216-23.04-2.56-22.528q0-20.48 13.824-33.792t37.376-12.288l103.424 0q20.48 0 32.768 6.144t19.456 15.36 10.24 18.944 5.12 16.896q2.048 8.192 4.096 23.04t4.096 30.208q3.072 18.432 6.144 38.912l700.416 0zM892.928 302.08l-641.024-2.048 35.84 185.344 535.552 1.024z" p-id="5147" fill="#ffffff"></path></svg></a>';
btnQuickView += '</div>';
$(this).find(config.btnContainer).prepend(btnQuickView);
$(this).addClass('sparsh-quick-view-item');
}
}
});
},
_bindPopup: function (config) {
var self = this;
$('.' + config.handlerClassName).each(
function () {
$(this).magnificPopup(
{
type: 'ajax',
closeOnContentClick: false,
closeMarkup: '<button title="Close (Esc)" type="button" class="sparsh-mfp-close sparsh-mfp-quick-close"></button>',
callbacks: {
ajaxContentAdded: function () {
$('.sparsh-mfp-content').trigger('contentUpdated');
$('.sparsh-mfp-content').prop('id', 'sparsh-mfp-quickview');
$('#sparsh-mfp-quickview').prepend('<div class="sparsh-mfp-quickview-message"></div>');
if($('#sparsh-mfp-quickview').find('.table-wrapper.grouped').length){
$('.sparsh-mfp-content').addClass('page-product-grouped');
}
if($('#sparsh-mfp-quickview').find('.field.downloads').length){
$('.sparsh-mfp-content').addClass('page-product-downloadable');
}
$('.sparsh-mfp-content').addClass('catalog-product-view');
if(!$('body').hasClass('page-layout-1column')){
$('.sparsh-mfp-content').addClass('page-layout-1column');
if($('.sparsh-mfp-content').hasClass('page-product-downloadable')){
$('.sparsh-mfp-content').addClass('sparsh-quickview-custom-options');
}
}
}
}
}
);
}
);
$(document).on(
'ajaxComplete', function (event, xhr, settings) {
if (settings.type.match(/get/i) && _.isObject(xhr.responseJSON)) {
var result = xhr.responseJSON;
if (_.isObject(result.cart) && _.isObject(result.messages)) {
if(result.messages){
if($('#sparsh-mfp-quickview').length) {
var btn=$('.sparsh-mfp-quick-close');
btn.click();
}
}
}
}
}
);
}
}
);
return $.sparsh.QuickView;
}
);
define(
[
'jquery',
'Magento_Ui/js/model/messageList'
], function ($) {
'use strict';
$.widget(
'sparsh.wishlist', {
_create: function () {
this.action();
},
action: function () {
var self = this,
popup = $('#sparsh-mfp-quickview');
$('#sparsh-mfp-quickview').delegate(
'.action.towishlist', 'click', function (e) {
var element = $(this),
dataPost = $(element).data('post'),
key = $('input[name="form_key"]').val();
console.log(dataPost.data);
if (key) {
dataPost.data.form_key = key;
}
var parameter = $.param(dataPost.data),
url = dataPost.action + (parameter.length ? '?' + parameter : '');
e.stopPropagation();
e.preventDefault();
$.ajax(
{
url: url,
type: 'post',
dataType: 'json',
showLoader: true,
success: function (res) {
popup = $('#sparsh-mfp-quickview');
$('.sparsh-mfp-quickview-message').addClass('message-success success message').html('<div>' + res.message + '</div>');
popup.animate({scrollTop: 0}, "slow");
var checkExist = setInterval(function () {
if ($('div.page.messages').find('.message-success').length) {
clearInterval(checkExist);
$('div.page.messages').find('.message-success').remove();
}
}, 50);
},
error: function () {
window.location.href = self.options.loginUrl;
}
}
);
}
)
}
}
);
return $.sparsh.wishlist;
}
);
\ No newline at end of file
......@@ -14,7 +14,8 @@ foreach($ids as $pid):
if(!$product) continue;
$productImage = $imageHelper->init( $product, 'category_page_list' ) ->getUrl();
?>
<div class="flash-sale-item">
<div class="flash-sale-item add-product-shop-car">
<div class=" product-item-info">
<a href="<?php echo $product->getProductUrl()?>" >
<img src="<?php echo $productImage;?>" loading="lazy" /></a>
<div class="flash-sale-info">
......@@ -23,6 +24,7 @@ foreach($ids as $pid):
<?= /* @noEscape */ $blocklist->getProductPrice($product) ?>
</div>
</div>
</div>
<?php
endforeach;
?>
\ No newline at end of file
......@@ -2205,7 +2205,7 @@ background-color: #000;
}
.scroll-active{
background: #ffffff;
z-index: 1000;
z-index: 996;
width: 100%;
position: fixed;
padding-right: 20px;
......
......@@ -578,7 +578,7 @@
.header.links {
min-width: 175px;
z-index: 1000;
z-index: 996;
}
&.active {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment