ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,18 @@
<?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>
<referenceContainer name="content">
<block template="catalog/product/prev_next_link.phtml" class="Olegnax\Athlete2\Block\Html\PrevNextProduct" name="ox_prev_product" before="-">
<arguments>
<argument name="is_next" xsi:type="boolean">false</argument>
</arguments>
</block>
<block template="catalog/product/prev_next_link.phtml" class="Olegnax\Athlete2\Block\Html\PrevNextProduct" name="ox_next_product" before="-">
<arguments>
<argument name="is_next" xsi:type="boolean">true</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,9 @@
<?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>
<referenceBlock name="head.additional">
<block class="Magento\Framework\View\Element\Template" name="ox_athlete2_ajax_add_to_cart"
template="Olegnax_Athlete2::ajax-add-to-cart.phtml"/>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,7 @@
<?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>
<move element="product.info.main" destination="athlete2_product_info_wrapper"/>
<move element="product.info.media" destination="athlete2_product_info_wrapper" before="product.info.main" />
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="catalog.product.related" destination="page.bottom.container"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="catalog.product.related" destination="athlete2_after_gallery"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="catalog.product.related" destination="athlete2_product_bottom"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="product.info.details" destination="page.bottom.container" />
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="product.info.details" destination="athlete2_after_gallery" />
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="product.info.details" destination="athlete2_product_bottom" />
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="product.info.details" destination="product.info.main" before="product_view_ox_block"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="product.info.upsell" destination="page.bottom.container"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="product.info.upsell" destination="athlete2_after_gallery"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="product.info.upsell" destination="athlete2_product_bottom"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="reviews.tab" destination="athlete-reviews-wrapper" />
</body>
</page>
@@ -0,0 +1,7 @@
<?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>
<move element="reviews.tab" destination="athlete-reviews-wrapper" />
<move element="athlete-reviews-wrapper" destination="page.bottom.container" />
</body>
</page>
@@ -0,0 +1,7 @@
<?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>
<move element="reviews.tab" destination="athlete-reviews-wrapper" />
<move element="athlete-reviews-wrapper" destination="athlete2_after_gallery" />
</body>
</page>
@@ -0,0 +1,7 @@
<?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>
<move element="reviews.tab" destination="athlete-reviews-wrapper" />
<move element="athlete-reviews-wrapper" destination="athlete2_product_bottom" />
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="category.cms" destination="main"/>
</body>
</page>
@@ -0,0 +1,9 @@
<?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>
<move element="breadcrumbs" destination="main" before="-"/>
<move element="page.main.title" destination="main" after="breadcrumbs"/>
<move element="category.image" destination="main" after="page.main.title"/>
<move element="category.description" destination="main" after="category.image"/>
</body>
</page>
@@ -0,0 +1,10 @@
<?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>
<referenceBlock name="product.info.media.image">
<action method="setTemplate">
<argument name='template' xsi:type='string'>product/view/css_only_gallery.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<move element="minicart" destination="athlete2_topline"/>
</body>
</page>
@@ -0,0 +1,15 @@
<?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>
<referenceBlock name="top.search">
<arguments>
<argument name="configProvider" xsi:type="object">Magento\Search\ViewModel\ConfigProvider</argument>
</arguments>
</referenceBlock>
<referenceBlock name="top.search.panel">
<arguments>
<argument name="configProvider" xsi:type="object">Magento\Search\ViewModel\ConfigProvider</argument>
</arguments>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,39 @@
<?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>
<referenceBlock name="header_account_drop">
<block class="Magento\Customer\Block\Form\Login" name="customer_form_login"
template="Magento_Customer::form/login_drop.phtml">
<container name="header_form.additional.info" as="form_additional_info_drop">
<block class="Magento\ReCaptchaUi\Block\ReCaptcha" name="recaptcha-login-drop" after="-"
template="Magento_ReCaptchaFrontendUi::recaptcha.phtml"
ifconfig="recaptcha_frontend/type_for/customer_login">
<arguments>
<argument name="recaptcha_for" xsi:type="string">customer_login</argument>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="recaptcha" xsi:type="array">
<item name="component" xsi:type="string">
Magento_ReCaptchaFrontendUi/js/reCaptcha
</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
<arguments>
<argument name="login_button_view_model" xsi:type="object">Magento\Customer\ViewModel\LoginButton</argument>
</arguments>
</block>
<block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="Magento_Customer::newcustomer.phtml"/>
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="loginButton" xsi:type="string">.action.login</item>
</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,38 @@
<?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>
<referenceBlock name="header_account_drop">
<block class="Magento\Customer\Block\Form\Login" name="customer_form_login"
template="Magento_Customer::form/login_drop.phtml">
<container name="header_form.additional.info" as="form_additional_info_drop">
<block class="MSP\ReCaptcha\Block\Frontend\ReCaptcha" name="ox-recaptcha-login" after="-"
template="MSP_ReCaptcha::msp_recaptcha.phtml"
ifconfig="msp_securitysuite_recaptcha/frontend/enabled">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="msp-recaptcha" xsi:type="array">
<item name="component" xsi:type="string">MSP_ReCaptcha/js/reCaptcha</item>
<item name="zone" xsi:type="string">login</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
<arguments>
<argument name="login_button_view_model" xsi:type="object">Magento\Customer\ViewModel\LoginButton</argument>
</arguments>
</block>
<block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="Magento_Customer::newcustomer.phtml"/>
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="loginButton" xsi:type="string">.action.login</item>
</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,35 @@
<?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>
<referenceBlock name="header_account_drop">
<block class="Magento\Customer\Block\Form\Login" name="customer_form_login"
template="Magento_Customer::form/login_drop.phtml">
<container name="header_form.additional.info" as="form_additional_info_drop">
<block class="Olegnax\Athlete2\Block\Frontend\ReCaptcha" name="ox-recaptcha-login" after="-"
template="Olegnax_Athlete2::msp_recaptcha.phtml"
ifconfig="msp_securitysuite_recaptcha/frontend/enabled">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="msp-recaptcha" xsi:type="array">
<item name="component" xsi:type="string">MSP_ReCaptcha/js/reCaptcha</item>
<item name="zone" xsi:type="string">login</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
</block>
<block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="Magento_Customer::newcustomer.phtml"/>
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="loginButton" xsi:type="string">.action.login</item>
</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,10 @@
<?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>
<referenceBlock name="product.info.media.image">
<action method="setTemplate">
<argument name='template' xsi:type='string'>Magento_Catalog::product/view/gallery-noslider.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<referenceBlock name="msp-recaptcha" remove="true"/>
</body>
</page>
@@ -0,0 +1,6 @@
<?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>
<referenceBlock name="product.info.media.video" remove="true"/>
</body>
</page>
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="ox_newsletter_popup" remove="true"/>
</body>
</page>
@@ -0,0 +1,9 @@
var config = {
config: {
mixins: {
'Amasty_Conf/js/swatch-renderer': {
'Olegnax_Athlete2/js/Amasty_Conf/swatch-renderer': true
}
}
}
};
@@ -0,0 +1,17 @@
<?php
use Olegnax\Athlete2\Helper\Helper;
/** @var Helper $_helper */
$_helper = $this->helper(Helper::class);
$js = [];
if ('1' == $_helper->getModuleConfig('products_listing/catalog_ajax_add_to_cart')) {
$js[] = 'window.OXNAjaxCatalog = true;';
}
if ('1' == $_helper->getModuleConfig('products_listing/show_minicart_after_added_product')) {
$js[] = 'window.OXAjaxNShowMCart = true;';
}
if (!empty($js)) {
echo sprintf('<script>%s</script>', implode('', $js));
}
@@ -0,0 +1,24 @@
<?php
/** @var PrevNextProduct $block */
use Olegnax\Athlete2\Block\Html\PrevNextProduct;
$link_sufix = $block->getIsNext() ? 'next' : 'previous';
$label_text = $block->escapeHtml(__($block->getIsNext() ? 'Next' : 'Previous'));
?>
<a href="<?php echo $block->getProductUrl() ?>" class="ox-prev-next__link ox-product-link-<?= $link_sufix; ?>"
rel="<?= $link_sufix; ?>">
<span class="content-wrapper">
<span class="inner">
<span class="content">
<span class="name"><?php echo $block->getName(); ?></span>
<span class="label"><?= $label_text; ?></span>
</span>
<span class="image-wrapper"><span
class="overlay"></span><?php echo $block->getResizedImage('category_page_grid', [125, 145])->toHtml(); ?></span>
</span>
</span>
<span class="ox-prev-next__arrow"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 20 20" xml:space="preserve">
<polygon points="15.8,10.5 6.6,1.4 5.2,2.8 12.9,10.5 5.2,18.3 6.6,19.7 15.8,10.5 15.8,10.5 "/></svg></span>
</a>
@@ -0,0 +1,11 @@
<?php
if ($this->getConfig('athlete2_design/appearance_custom/inline_css')) {
$content = $this->getChildHtml('athlete2_dynamic_css');
if (!empty($content)) {
$content = preg_replace('/[\r\n\t]/', ' ', $content);
$content = preg_replace('/[\r\n\t ]{2,}/', ' ', $content);
$content = preg_replace('/\s+(\:|\;|\{|\})\s+/', '\1', $content);
$content = preg_replace('/<[^<>]+>(.*?)<\/[^<>]+>/m', '/* Forbidden tags in styles */', $content);
echo '<style type="text/css">' . $content . '</style>';
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,45 @@
<?php
/**
* MageSpecialist
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to info@magespecialist.it so we can send you a copy immediately.
*
* @category MSP
* @package MSP_ReCaptcha
* @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
use Olegnax\Athlete2\Block\Frontend\ReCaptcha;
/** @var $block ReCaptcha */
?>
<div
class="field-recaptcha"
id="<?= /* @noEscape */
$block->getRecaptchaId() ?>-container"
data-bind="scope:'<?= /* @noEscape */
$block->getRecaptchaId() ?>'"
>
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
<script type="text/x-magento-init">
{
"#<?= /* @noEscape */
$block->getRecaptchaId() ?>-container": {
"Magento_Ui/js/core/app": <?= /* @noEscape */
$block->getJsLayout() ?>
}
}
</script>
@@ -0,0 +1,27 @@
<?php
/**
* Athlete2 Theme
*
* @author Olegnax
* @package Olegnax_Athlete2
* @copyright Copyright (c) 2023 Olegnax (https://olegnax.com). All rights reserved.
* @license https://www.olegnax.com/license
*/
use Magento\Framework\View\Element\Template;
use Olegnax\Athlete2\Helper\Video;
/** @var Template $block */
$attributes = (array)$block->getVideoAttrs();
$attributes = array_replace($attributes, [
'tabindex' => -1,
'playsinline' => true,
'class' => 'ox-grid-gallery-video',
]);
?>
<video<?= Video::prepareAttributes($attributes) ?>>
<?php foreach ($block->getMimeFiles() as $mime => $url): ?>
<source src="<?= $url ?>" type="<?= $mime ?>">
<?php endforeach; ?>
</video>
@@ -0,0 +1,54 @@
<?php
$links = $block->getSocialLinks();
$socials_id = $block->getSocialsId();
$iconsStyle = $block->getLinkStyle();
$iconsSize = $block->getLinkSize();
$classes = [];
$selector = '';
$linkRel = '';
$linkRelAtts = [];
if($block->getLinkNoopener()){
$linkRelAtts[] = 'noopener';
}
if($block->getLinkNoreferrer()){
$linkRelAtts[] = 'noreferrer';
}
if($block->getLinkNofollow()){
$linkRelAtts[] = 'nofollow';
}
if(!empty($linkRelAtts)){
$linkRel = ' rel="' . implode(' ', $linkRelAtts) . '"';
}
if($iconsSize == 'tiny') {
$classes[] = 'size-tiny';
}
if($iconsStyle == 'simple'){
$classes[] = 'athlete2-social-icons-' . $iconsStyle;
$selector = '#' . $socials_id . '.athlete2-social-icons-'. $iconsStyle .' > a.athlete2-social-icon';
} else {
$classes[] = 'athlete2-social-icons';
$selector = '#' . $socials_id . '.athlete2-social-icons > a.athlete2-social-icon';
}
$linkTarget = $block->getLinkTarget() ?: 'self';
$selector_h = $selector . ':hover';
$colors = [];
$colors[ $selector . ':not(:hover)' ] = [
'color' => $block->getTextColor(),
'background' => $block->getBackground(),
];
$colors[ $selector_h ] = [
'color' => $block->getTextHoverColor(),
'background' => $block->getBackgroundHover(),
];
if ( !empty( $links ) ) :
?>
<?= $block->prepareStyleBlock( $colors ); ?>
<div id="<?= $socials_id ?>" class="<?= implode(' ', $classes); ?>">
<?php foreach ( $links as $social => $link ): ?>
<?php $social = str_replace('_', '-', $social); ?>
<a href="<?= $link ?>" class="athlete2-social-icon athlete2-icon-<?= $social ?>" target="_<?= $linkTarget ?>"<?= $linkRel ?>><span><?= $social ?></span></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
@@ -0,0 +1,57 @@
& when (@media-common = true) {
.product-item{
.product-grid__image-wrapper {
.ox-grid-gallery-video{
opacity: 0;
visibility: hidden;
z-index: 2;
}
.ox-product-hover-image-container{
.product-image-photo {
.lib-css(transition, .3s, @_prefix: 1);
.lib-css(transition-property, ~"opacity, visibility", @_prefix: 1);
}
.product-first-image-photo {
opacity: 1;
visibility: visible;
z-index: 1;
&.owl-lazy{
opacity:0;
}
}
.product-second-image-photo{
opacity: 0;
visibility: hidden;
z-index: 2;
}
}
}
&:not(:hover){
.product-grid__image-wrapper {
.ox-product-hover-image-container{
.product-second-image-photo{
opacity: 0!important;
}
}
}
}
&:hover {
.product-grid__image-wrapper {
.ox-grid-gallery-video{
opacity: 1;
visibility: visible;
}
.ox-product-hover-image-container{
.product-first-image-photo {
opacity: 0!important;
visibility: hidden;
}
.product-second-image-photo{
opacity: 1;
visibility: visible;
}
}
}
}
}
}
@@ -0,0 +1,71 @@
define([
'jquery'
], function ($) {
'use strict';
return function (widget) {
$.widget('amasty_conf.SwatchRenderer', widget, {
_AmOnClick: function ($this, $widget) {
$widget._OnClick($this, $widget);
var slickSlide = $this,
possibleSlide = $this.parent();
// fix for when price in title enabled
if (possibleSlide.hasClass('slick-slide')) {
slickSlide = possibleSlide;
}
if (slickSlide.hasClass('slick-slide') && $this.hasClass('selected')) {
slickSlide.parent()
.find('[option-id="' + $this.attr('option-id') + '"]:not(.selected)')
.addClass('selected');
}
if (this.amasty_conf_config && this.amasty_conf_config.share.enable == '1') {
$widget._addHashToUrl($this, $widget);
}
$widget._reloadProductInformation($this, $widget);
var isProductViewExist = $('body.catalog-product-view').length > 0;
if (isProductViewExist) {
$widget._RenderPricesForControls();
}
if (isProductViewExist || this.ajaxCart) {
this._saveLastRowContent();
$widget._RenderProductMatrix();
if (this.options.jsonConfig.swatches_slider) {
this._generateSliderSwatches();
}
}
$widget._addOutOfStockLabels();
},
onMouseLeave: function($this, $widget) {
var $parent = $this.parents('.' + $widget.options.classes.attributeClass),
selectedOption = $parent.find('.' + $widget.options.classes.optionClass + '.selected'),
$label = $parent.find('.' + $widget.options.classes.attributeSelectedOptionLabelClass),
$input = $parent.find('.' + $widget.options.classes.attributeInput),
attributeId = $this.attr('attribute-id')
|| $this.attr('data-attribute-id')
|| selectedOption.attr('attribute-id')
|| selectedOption.attr('data-attribute-id'),
selectedOptionAttributeClass = $widget.options.jsonConfig.selected_option_attribute_class || 'option-selected';
if ($widget.inProductList) {
$input = $widget.productForm.find(
'.' + $widget.options.classes.attributeInput + '[name="super_attribute[' + attributeId + ']"]'
);
}
if (selectedOption.length > 0) {
$parent.attr(selectedOptionAttributeClass, selectedOption.attr('option-id'));
} else {
$parent.removeAttr(selectedOptionAttributeClass).find('.selected').removeClass('selected');
$input.val('');
$label.text('');
$this.attr('aria-checked', false);
}
$widget._loadMedia();
},
});
return $.amasty_conf.SwatchRenderer;
}
});