ltsecurityinc安防产品在线商城代码
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
-->
|
||||
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<fieldset name="display_settings" sortOrder="20">
|
||||
<settings>
|
||||
<collapsible>true</collapsible>
|
||||
<label translate="true">Display Settings</label>
|
||||
</settings>
|
||||
<field name="ox_nav_disable_ajax" sortOrder="60" formElement="checkbox">
|
||||
<argument name="data" xsi:type="array">
|
||||
<item name="config" xsi:type="array">
|
||||
<item name="default" xsi:type="number">0</item>
|
||||
</item>
|
||||
</argument>
|
||||
<settings>
|
||||
<dataType>boolean</dataType>
|
||||
<label translate="true">Disable AJAX in Layered Navigation</label>
|
||||
</settings>
|
||||
<formElements>
|
||||
<checkbox>
|
||||
<settings>
|
||||
<valueMap>
|
||||
<map name="false" xsi:type="string">0</map>
|
||||
<map name="true" xsi:type="string">1</map>
|
||||
</valueMap>
|
||||
<prefer>toggle</prefer>
|
||||
</settings>
|
||||
</checkbox>
|
||||
</formElements>
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
Executable
+6
@@ -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">
|
||||
<update handle="layered_navigation_handle" />
|
||||
<update handle="layered_navigation_templates" />
|
||||
</page>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?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="layered_navigation_handle" />
|
||||
<body>
|
||||
<referenceBlock name="catalogsearch.leftnav">
|
||||
<action method="setTemplate" ifconfig="olegnax_layered_navigation/general/enable">
|
||||
<argument name="template" xsi:type="string">Olegnax_LayeredNavigation::layer/view.phtml</argument>
|
||||
</action>
|
||||
</referenceBlock>
|
||||
<referenceBlock name="catalogsearch.navigation.renderer">
|
||||
<action method="setTemplate" ifconfig="olegnax_layered_navigation/general/enable">
|
||||
<argument name="template" xsi:type="string">Olegnax_LayeredNavigation::layer/filter.phtml</argument>
|
||||
</action>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceContainer name="before.body.end">
|
||||
<block class="Magento\Framework\View\Element\Template" name="ox_layerednavigation_loader" template="Olegnax_LayeredNavigation::loader.phtml"
|
||||
ifconfig="olegnax_layered_navigation/general/enable"/>
|
||||
<block class="Olegnax\LayeredNavigation\Block\Template" name="ox_layerednavigation_initialize" template="Olegnax_LayeredNavigation::initialize.phtml"
|
||||
ifconfig="olegnax_layered_navigation/general/enable"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="catalog.leftnav">
|
||||
<action method="setTemplate" ifconfig="olegnax_layered_navigation/general/enable">
|
||||
<argument name="template" xsi:type="string">Olegnax_LayeredNavigation::layer/view.phtml</argument>
|
||||
</action>
|
||||
</referenceBlock>
|
||||
<referenceBlock name="catalog.navigation.renderer">
|
||||
<action method="setTemplate" ifconfig="olegnax_layered_navigation/general/enable">
|
||||
<argument name="template" xsi:type="string">Olegnax_LayeredNavigation::layer/filter.phtml</argument>
|
||||
</action>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,18 @@
|
||||
var config = {
|
||||
map: {
|
||||
'*': {
|
||||
'OXPriceSlider': 'Olegnax_LayeredNavigation/js/price-slider',
|
||||
'wNumb': 'Olegnax_LayeredNavigation/js/wNumb.min',
|
||||
'OXAjaxNav': 'Olegnax_LayeredNavigation/js/ajax-nav',
|
||||
'oxFormValues': 'Olegnax_LayeredNavigation/js/form-values',
|
||||
'noUiSlider': 'Olegnax_LayeredNavigation/js/nouislider.min',
|
||||
}
|
||||
},
|
||||
config: {
|
||||
mixins: {
|
||||
'Magento_Swatches/js/swatch-renderer': {
|
||||
'Olegnax_LayeredNavigation/js/swatch-renderer': true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
|
||||
use Olegnax\LayeredNavigation\Block\Template;
|
||||
|
||||
/** @var Template $block */
|
||||
?>
|
||||
|
||||
<script>
|
||||
requirejs(['jquery', 'OXAjaxNav'],
|
||||
function ($) {
|
||||
"use strict";
|
||||
|
||||
$(function () {
|
||||
$('body').OXAjaxNav(<?= $block->getNavConfig(); ?>);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
|
||||
use Magento\Catalog\Model\Layer\Filter\AbstractFilter;
|
||||
use Magento\CatalogSearch\Model\Layer\Filter\Category;
|
||||
use Magento\CatalogSearch\Model\Layer\Filter\Price;
|
||||
use Magento\LayeredNavigation\Block\Navigation\FilterRenderer;
|
||||
use Olegnax\LayeredNavigation\Helper\Filter;
|
||||
use Olegnax\LayeredNavigation\Helper\Helper;
|
||||
use Olegnax\LayeredNavigation\Model\Config\Source\FiltersType;
|
||||
|
||||
/**
|
||||
* Template for filter items block
|
||||
*
|
||||
* @var $block FilterRenderer
|
||||
* @var $filter AbstractFilter
|
||||
*/
|
||||
|
||||
/** @var Filter $helperFilter */
|
||||
$helperFilter = $this->helper(Filter::class);
|
||||
$showCheckbox = $this->helper(Helper::class)->getModuleConfig('general/filters_type');
|
||||
$isCategorie = $filter instanceof Category;
|
||||
$requestVar = $filter->getRequestVar();
|
||||
|
||||
if ($filter instanceof Price && $filter->getIsSlider()): ?>
|
||||
<div class="item item-price-slider" data-mage-init='{"OXPriceSlider":<?php echo $filter->getSliderConfig(); ?>}'>
|
||||
<div class="ox-price-slider" style="display:none;"></div>
|
||||
<div class="ox-price-filter__values">
|
||||
<span class="ox-slider-min"></span>
|
||||
<span class="ox-slider-max"></span>
|
||||
<input<?= $showCheckbox !== FiltersType::TYPE_CHECKBOX ? ' class="ox-nav-use-url"' : '' ?> type="text" name="filter[<?= $requestVar ?>]"
|
||||
value="<?= $helperFilter->getSelectedSlider($filter); ?>" placeholder="<?= $filter->getLabel() ?>"/>
|
||||
<span class="ox-price-filter__selected" style="display:none;">
|
||||
<?= $filter->getLabel() ? $filter->getLabel() . ': ' : '' ?>
|
||||
<span class="ox-slider-from"></span> <span class="separator">–</span>
|
||||
<span class="ox-slider-to"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<ol class="items <?php if ($showCheckbox == FiltersType::TYPE_CHECKBOX) {
|
||||
echo 'ox-layered__items--checkbox';
|
||||
} ?> ">
|
||||
<?php foreach ($filterItems as $filterItem): ?>
|
||||
<li class="item<?= $helperFilter->checkedFilter($filterItem, ' ox-seleted-item') . $filterItem->getData('item_level')? ' ox-item-level-'.$filterItem->getData('item_level'):''; ?>">
|
||||
<?php if ($filterItem->getCount() > 0): ?>
|
||||
<?php if ($filter->getIsDisableAjax($filterItem) && ($filter instanceof Category)): ?>
|
||||
<?php if ($showCheckbox == FiltersType::TYPE_CHECKBOX): ?>
|
||||
<label for="filter_item_<?= $requestVar . '_' . $filterItem->getValue(); ?>">
|
||||
<span class="ox-checkbox"></span>
|
||||
<a class="label ox-disable-ajax" rel="nofollow"
|
||||
href="<?= $filter->getUrlItem($filterItem) ?>">
|
||||
<?= /* @noEscape */
|
||||
$filterItem->getLabel() ?>
|
||||
</a>
|
||||
</label>
|
||||
<?php else: ?>
|
||||
<a class="ox-disable-ajax" rel="nofollow" href="<?= $filter->getUrlItem($filterItem) ?>">
|
||||
<?= /* @noEscape */
|
||||
$filterItem->getLabel() ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($showCheckbox == FiltersType::TYPE_CHECKBOX): ?>
|
||||
<input id="filter_item_<?= $requestVar . '_' . $filterItem->getValue(); ?>"
|
||||
type="checkbox" name="filter[<?= $requestVar ?>][]"
|
||||
value="<?= $filterItem->getValue(); ?>" <?= !$filterItem->getCount() ? 'disabled' : ''; ?><?= $helperFilter->checkedFilter($filterItem); ?> />
|
||||
<label for="filter_item_<?= $requestVar . '_' . $filterItem->getValue(); ?>">
|
||||
<span class="ox-checkbox"></span>
|
||||
<span class="label"><?= /* @noEscape */
|
||||
$filterItem->getLabel() ?></span>
|
||||
</label>
|
||||
<?php else: ?>
|
||||
<a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>" rel="nofollow">
|
||||
<?= /* @noEscape */
|
||||
$filterItem->getLabel() ?>
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<strong><?= /* @noEscape */
|
||||
$filterItem->getLabel() ?></strong>
|
||||
<?php endif; ?>
|
||||
<?php /* show counter */ ?>
|
||||
<?php if ($this->helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?>
|
||||
<span class="count"><?= /* @noEscape */
|
||||
(int)$filterItem->getCount()?:'' ?><span class="filter-count-label">
|
||||
<?php if ($filterItem->getCount() == 1) :
|
||||
?> <?= $block->escapeHtml(__('item')) ?><?php
|
||||
elseif ($filterItem->getCount() > 0) :
|
||||
?> <?= $block->escapeHtml(__('items')) ?><?php
|
||||
endif; ?></span></span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
|
||||
use Magento\LayeredNavigation\Block\Navigation\State;
|
||||
|
||||
// @codingStandardsIgnoreFile
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Category layered navigation state
|
||||
*
|
||||
* @var $block State
|
||||
*/
|
||||
?>
|
||||
<?php $_filters = $block->getActiveFilters() ?>
|
||||
<?php if (!empty($_filters)): ?>
|
||||
<div class="filter-current">
|
||||
<strong class="block-subtitle filter-current-subtitle"
|
||||
role="heading"
|
||||
aria-level="2"
|
||||
data-count="<?= count($_filters) ?>"><?= /* @escapeNotVerified */
|
||||
__('Now Shopping by') ?></strong>
|
||||
<ol class="items">
|
||||
<?php
|
||||
foreach ($_filters as $_filter):
|
||||
$requestVar = $_filter->getFilter()->getRequestVar();
|
||||
$filterItemVal = (is_array($_filter->getValue())) ? implode('-',
|
||||
$_filter->getValue()) : $_filter->getValue();
|
||||
?>
|
||||
<li class="item">
|
||||
<span class="filter-label"><?= $block->escapeHtml(__($_filter->getName())) ?></span>
|
||||
<span class="filter-value"><?= /* @escapeNotVerified */
|
||||
$block->stripTags($_filter->getLabel()) ?></span>
|
||||
<?php
|
||||
$clearLinkUrl = $_filter->getClearLinkUrl();
|
||||
$currentFilterName = $block->escapeHtml(__($_filter->getName())) . " " . $block->stripTags($_filter->getLabel());
|
||||
if ($clearLinkUrl):
|
||||
?>
|
||||
<a class="action previous" href="<?= /* @escapeNotVerified */
|
||||
$_filter->getRemoveUrl() ?>"
|
||||
title="<?= /* @escapeNotVerified */
|
||||
__('Previous') ?>" data-current-var="<?= /* @escapeNotVerified */
|
||||
$requestVar ?>" data-current-val="<?= /* @escapeNotVerified */
|
||||
$filterItemVal ?>">
|
||||
<span><?= /* @escapeNotVerified */
|
||||
__('Previous') ?></span>
|
||||
</a>
|
||||
<a class="action remove"
|
||||
title="<?= $block->escapeHtml($_filter->getFilter()->getClearLinkText()) ?>"
|
||||
href="<?= /* @escapeNotVerified */
|
||||
$clearLinkUrl ?>" data-current-var="<?= /* @escapeNotVerified */
|
||||
$requestVar ?>" data-current-val="<?= /* @escapeNotVerified */
|
||||
$filterItemVal ?>">
|
||||
<span><?= $block->escapeHtml($_filter->getFilter()->getClearLinkText()) ?></span>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="action remove" href="<?= /* @escapeNotVerified */
|
||||
$_filter->getRemoveUrl() ?>" data-current-var="<?= /* @escapeNotVerified */
|
||||
$requestVar ?>" data-current-val="<?= /* @escapeNotVerified */
|
||||
$filterItemVal ?>"
|
||||
title="<?= /* @escapeNotVerified */
|
||||
$block->escapeHtml(__('Remove')) . " " . $currentFilterName ?>">
|
||||
<span><?= /* @escapeNotVerified */
|
||||
__('Remove This Item') ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
?>
|
||||
<?php if ($block->canShowBlock()): ?>
|
||||
<div class="block filter">
|
||||
<div class="block-title filter-title">
|
||||
<strong><?= /* @escapeNotVerified */
|
||||
__('Shop By') ?></strong>
|
||||
</div>
|
||||
|
||||
<div class="block-content filter-content">
|
||||
<?= $block->getChildHtml('state') ?>
|
||||
|
||||
<?php if ($block->getLayer()->getState()->getFilters()): ?>
|
||||
<div class="block-actions filter-actions">
|
||||
<a href="<?= /* @escapeNotVerified */
|
||||
$block->getClearUrl() ?>" class="action clear filter-clear"><span><?= /* @escapeNotVerified */
|
||||
__('Clear All') ?></span></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php $wrapOptions = false; ?>
|
||||
<?php foreach ($block->getFilters() as $filter): ?>
|
||||
<?php if (!$wrapOptions): ?>
|
||||
<strong role="heading" aria-level="2" class="block-subtitle filter-subtitle"><?= /* @escapeNotVerified */
|
||||
__('Shopping Options') ?></strong>
|
||||
<dl class="filter-options" id="narrow-by-list">
|
||||
<?php $wrapOptions = true;
|
||||
endif; ?>
|
||||
<?php if ($filter->getItemsCount()): ?>
|
||||
<dt role="heading" aria-level="3"
|
||||
class="filter-options-title"><?= $block->escapeHtml(__($filter->getName())) ?></dt>
|
||||
<dd class="filter-options-content"><?= /* @escapeNotVerified */
|
||||
$block->getChildBlock('renderer')->render($filter) ?></dd>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($wrapOptions): ?>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
|
||||
use Olegnax\LayeredNavigation\Helper\Helper;
|
||||
use Olegnax\LayeredNavigation\Model\Config\Source\LoaderType;
|
||||
|
||||
/** @var Helper $_helper */
|
||||
$config = $this->helper(Helper::class)->getModuleConfig('general');
|
||||
$configLoaders = $this->helper(Helper::class)->getModuleConfig('loaders');
|
||||
|
||||
if ('' !== $configLoaders['loader_type_filters'] && $config['enable']): ?>
|
||||
<script data-role="ox-nav-loader-filter" type="text/x-magento-template">
|
||||
<div class="ox-product-nav ox-product-nav-filter ox-product-nav__loader--<?= $configLoaders['loader_type_filters']; ?>">
|
||||
<div class="ox-product-nav__loader">
|
||||
<?php if (LoaderType::TYPE_IMAGE == $configLoaders['loader_type_filters']): ?>
|
||||
<img src="<?= $this->getViewFileUrl($configLoaders['loader_filters']) ?>"
|
||||
class="ox-product-nav__loader-image"/>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<?php endif;
|
||||
if ('' !== $configLoaders['loader_type_content'] && $config['enable']): ?>
|
||||
<script data-role="ox-nav-loader-content" type="text/x-magento-template">
|
||||
<div class="ox-product-nav ox-product-nav-content ox-product-nav__loader--<?= $configLoaders['loader_type_content']; ?>">
|
||||
<div class="ox-product-nav__loader">
|
||||
<?php if (LoaderType::TYPE_IMAGE == $configLoaders['loader_type_content']): ?>
|
||||
<img src="<?= $this->getViewFileUrl($configLoaders['loader_content']) ?>"
|
||||
class="ox-product-nav__loader-image"/>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<?php endif;
|
||||
if ('' !== $configLoaders['loader_type_page'] && $config['enable']): ?>
|
||||
<script data-role="ox-nav-loader-page" type="text/x-magento-template">
|
||||
<div class="ox-product-nav ox-product-nav-page ox-product-nav__loader--<?= $configLoaders['loader_type_page']; ?>">
|
||||
<div class="ox-product-nav__loader">
|
||||
<?php if (LoaderType::TYPE_IMAGE == $configLoaders['loader_type_page']): ?>
|
||||
<img src="<?= $this->getViewFileUrl($configLoaders['loader_page']) ?>"
|
||||
class="ox-product-nav__loader-image"/>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<?php endif;
|
||||
Executable
+109
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
|
||||
// @codingStandardsIgnoreFile
|
||||
|
||||
/** @var $block RenderLayered */
|
||||
|
||||
use Magento\Swatches\Block\LayeredNavigation\RenderLayered; ?>
|
||||
<?php $swatchData = $block->getSwatchData(); ?>
|
||||
<div class="swatch-attribute swatch-layered <?= /* @escapeNotVerified */
|
||||
$swatchData['attribute_code'] ?>"
|
||||
attribute-code="<?= /* @escapeNotVerified */
|
||||
$swatchData['attribute_code'] ?>"
|
||||
attribute-id="<?= /* @escapeNotVerified */
|
||||
$swatchData['attribute_id'] ?>">
|
||||
<div class="swatch-attribute-options clearfix">
|
||||
<?php foreach ($swatchData['options'] as $option => $label): ?>
|
||||
<a href="<?= /* @escapeNotVerified */
|
||||
$label['link'] ?>"
|
||||
aria-label="<?= /* @escapeNotVerified */
|
||||
$label['label'] ?>"
|
||||
class="swatch-option-link-layered">
|
||||
<?php if (isset($swatchData['swatches'][$option]['type'])) { ?>
|
||||
<?php switch ($swatchData['swatches'][$option]['type']) {
|
||||
case '3':
|
||||
?>
|
||||
<div class="swatch-option <?= /* @escapeNotVerified */
|
||||
$label['custom_style'] ?>"
|
||||
tabindex="-1"
|
||||
data-option-type="3"
|
||||
data-option-id="<?= /* @escapeNotVerified */
|
||||
$option ?>"
|
||||
data-option-label="<?= /* @escapeNotVerified */
|
||||
$label['label'] ?>"
|
||||
data-option-tooltip-thumb=""
|
||||
data-option-tooltip-value=""
|
||||
></div>
|
||||
<?php break;
|
||||
case '2':
|
||||
?>
|
||||
<?php $swatchThumbPath = $block->getSwatchPath('swatch_thumb',
|
||||
$swatchData['swatches'][$option]['value']); ?>
|
||||
<?php $swatchImagePath = $block->getSwatchPath('swatch_image',
|
||||
$swatchData['swatches'][$option]['value']); ?>
|
||||
<div class="swatch-option image <?= /* @escapeNotVerified */
|
||||
$label['custom_style'] ?>"
|
||||
tabindex="-1"
|
||||
data-option-type="2"
|
||||
data-option-id="<?= /* @escapeNotVerified */
|
||||
$option ?>"
|
||||
data-option-label="<?= /* @escapeNotVerified */
|
||||
$label['label'] ?>"
|
||||
data-option-tooltip-thumb="<?= /* @escapeNotVerified */
|
||||
$swatchThumbPath ?>"
|
||||
data-option-tooltip-value=""
|
||||
style="background: url(<?= /* @escapeNotVerified */
|
||||
$swatchImagePath ?>) no-repeat center; background-size: initial;"></div>
|
||||
<?php break;
|
||||
case '1':
|
||||
?>
|
||||
<div class="swatch-option color <?= /* @escapeNotVerified */
|
||||
$label['custom_style'] ?>"
|
||||
tabindex="-1"
|
||||
data-option-type="1"
|
||||
data-option-id="<?= /* @escapeNotVerified */
|
||||
$option ?>"
|
||||
data-option-label="<?= /* @escapeNotVerified */
|
||||
$label['label'] ?>"
|
||||
data-option-tooltip-thumb=""
|
||||
data-option-tooltip-value="<?= /* @escapeNotVerified */
|
||||
$swatchData['swatches'][$option]['value'] ?>"
|
||||
style="background: <?= /* @escapeNotVerified */
|
||||
$swatchData['swatches'][$option]['value'] ?> no-repeat center; background-size: initial;"></div>
|
||||
<?php break;
|
||||
case '0':
|
||||
default:
|
||||
?>
|
||||
<div class="swatch-option text <?= /* @escapeNotVerified */
|
||||
$label['custom_style'] ?>"
|
||||
tabindex="-1"
|
||||
data-option-type="0"
|
||||
data-option-id="<?= /* @escapeNotVerified */
|
||||
$option ?>"
|
||||
data-option-label="<?= /* @escapeNotVerified */
|
||||
$label['label'] ?>"
|
||||
data-option-tooltip-thumb=""
|
||||
data-option-tooltip-value=""
|
||||
><?= /* @escapeNotVerified */
|
||||
$swatchData['swatches'][$option]['value'] ?></div>
|
||||
<?php break;
|
||||
} ?>
|
||||
<?php } ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
require(["jquery", "jquery-ui-modules/widget", "Magento_Swatches/js/swatch-renderer"], function ($) {
|
||||
$('.swatch-layered.<?= /* @escapeNotVerified */ $swatchData['attribute_code'] ?>')
|
||||
.find('[data-option-type="1"], [data-option-type="2"], [data-option-type="0"], [data-option-type="3"]')
|
||||
.SwatchRendererTooltip();
|
||||
});
|
||||
</script>
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
// /**
|
||||
// * Olegnax Layeren Navigation
|
||||
// * Copyright (c) Olegnax. All rights reserved.
|
||||
// */
|
||||
|
||||
@import '_noui-slider.less';
|
||||
|
||||
//
|
||||
// Variables
|
||||
// _____________________________________________
|
||||
|
||||
@css-preloader-color: #000000;
|
||||
@css-preloader-size: 35px;
|
||||
@css-preloader-border-size: 4px;
|
||||
|
||||
//
|
||||
// Common
|
||||
// _____________________________________________
|
||||
|
||||
& when (@media-common = true) {
|
||||
|
||||
.column.main .products.products-grid,
|
||||
.column.main .products.products-list,
|
||||
.column.main .products-grid.grid,
|
||||
.sidebar.sidebar-main .block.filter {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ox-product-nav {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
top:0;
|
||||
left:0;
|
||||
|
||||
&.ox-product-nav-page {
|
||||
position: fixed;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.ox-product-nav__loader {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate3d(-50%, -50%, 0);
|
||||
}
|
||||
|
||||
&.ox-product-nav__loader--magento {
|
||||
.ox-product-nav__loader {
|
||||
.lib-loading();
|
||||
width: @loader-icon__width;
|
||||
height: @loader-icon__height;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.ox-product-nav__loader--css {
|
||||
.ox-product-nav__loader {
|
||||
display: block;
|
||||
width: @css-preloader-size;
|
||||
height: @css-preloader-size;
|
||||
border: @css-preloader-border-size solid rgba(0, 0, 0, 0);
|
||||
border-radius: @css-preloader-size;
|
||||
border-left: @css-preloader-border-size solid @css-preloader-color;
|
||||
border-right: @css-preloader-border-size solid @css-preloader-color;
|
||||
border-top: @css-preloader-border-size solid @css-preloader-color;
|
||||
animation: spin .65s infinite linear;
|
||||
transition: all 600ms ease-in-out;
|
||||
margin-left: -17px;
|
||||
margin-top: -17px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-options-content{
|
||||
.item {
|
||||
&.item-price-slider {
|
||||
display: block;
|
||||
padding-right: 3px;
|
||||
}
|
||||
&[class*='ox-item-level-']{
|
||||
padding-left: 30px;
|
||||
}
|
||||
&.ox-item-level-,
|
||||
&.ox-item-level-0{
|
||||
padding-left: 0;
|
||||
}
|
||||
&.ox-item-level-1{
|
||||
padding-left: 12px;
|
||||
}
|
||||
&.ox-item-level-2{
|
||||
padding-left: 24px;
|
||||
}
|
||||
}
|
||||
.ox-layered__items--checkbox{
|
||||
.item{
|
||||
input{
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
height: 0;
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-price-filter__values {
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
|
||||
.ox-slider-min {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.ox-slider-max {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.ox-slider-max,
|
||||
.ox-slider-min {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
+425
@@ -0,0 +1,425 @@
|
||||
// /**
|
||||
// * Olegnax Layeren Navigation - noUiSlider
|
||||
// * Copyright (c) Olegnax. All rights reserved.
|
||||
// */
|
||||
|
||||
@main_color: #ffe51e;
|
||||
|
||||
//
|
||||
// Common
|
||||
// _____________________________________________
|
||||
|
||||
& when (@media-common = true) {
|
||||
/* Offset direction
|
||||
*/
|
||||
|
||||
html:not([dir="rtl"]) .filter-options-content .noUi-horizontal .noUi-origin {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
html:not([dir="rtl"]) .filter-options-content .noUi-horizontal .noUi-handle {
|
||||
right: -6px;
|
||||
left: auto;
|
||||
}
|
||||
.filter-options-content{
|
||||
.noUi-target,
|
||||
.noUi-target * {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
-webkit-user-select: none;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
-ms-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.noUi-target {
|
||||
position: relative;
|
||||
direction: ltr;
|
||||
&.noUi-horizontal{
|
||||
margin: 10px 6px 45px;
|
||||
}
|
||||
}
|
||||
.noUi-base,
|
||||
.noUi-connects {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* Wrapper for all connect elements.
|
||||
*/
|
||||
|
||||
.noUi-connects {
|
||||
overflow: hidden;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.noUi-connect,
|
||||
.noUi-origin {
|
||||
will-change: transform;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 0;
|
||||
-ms-transform-origin: 0 0;
|
||||
-webkit-transform-origin: 0 0;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
transform-origin: 0 0;
|
||||
transform-style: flat;
|
||||
}
|
||||
|
||||
.noUi-connect {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.noUi-origin {
|
||||
height: 10%;
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
/* Give origins 0 height/width so they don't interfere with clicking the
|
||||
* connect elements.
|
||||
*/
|
||||
|
||||
.noUi-vertical .noUi-origin {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.noUi-horizontal .noUi-origin {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.noUi-handle {
|
||||
-webkit-backface-visibility: hidden;
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.noUi-touch-area {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.noUi-state-tap .noUi-connect,
|
||||
.noUi-state-tap .noUi-origin {
|
||||
-webkit-transition: transform 0.3s;
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
.noUi-state-drag * {
|
||||
cursor: inherit !important;
|
||||
}
|
||||
|
||||
/* Slider size and handle placement;
|
||||
*/
|
||||
|
||||
.noUi-horizontal {
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.noUi-horizontal .noUi-handle {
|
||||
width: 12px;
|
||||
height: 18px;
|
||||
left: -6px;
|
||||
top: -6px;
|
||||
cursor: w-resize;
|
||||
}
|
||||
|
||||
.noUi-vertical {
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
.noUi-vertical .noUi-handle {
|
||||
width: 28px;
|
||||
height: 34px;
|
||||
left: -6px;
|
||||
top: -17px;
|
||||
}
|
||||
|
||||
/* Styling;
|
||||
* Giving the connect element a border radius causes issues with using transform: scale
|
||||
*/
|
||||
|
||||
.noUi-target {
|
||||
background: #e4e4e4;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.noUi-connects {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.noUi-connect {
|
||||
background: @main_color;
|
||||
}
|
||||
|
||||
/* Handles and cursors;
|
||||
*/
|
||||
|
||||
.noUi-draggable {
|
||||
cursor: ew-resize;
|
||||
}
|
||||
.ox-price-filter__values{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.noUi-vertical .noUi-draggable {
|
||||
cursor: ns-resize;
|
||||
}
|
||||
|
||||
.noUi-handle {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: #000000;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.noUi-handle{
|
||||
.noUi-tooltip{
|
||||
opacity:0;
|
||||
transition:opacity 200ms ease;
|
||||
}
|
||||
&.noUi-active,
|
||||
&:hover{
|
||||
.noUi-tooltip{
|
||||
opacity:1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
.noUi-active {
|
||||
background: @main_color;
|
||||
}*/
|
||||
|
||||
/* Handle stripes;
|
||||
*/
|
||||
|
||||
/*
|
||||
.noUi-handle:before,
|
||||
.noUi-handle:after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
height: 14px;
|
||||
width: 1px;
|
||||
background: #E8E7E6;
|
||||
left: 14px;
|
||||
top: 6px;
|
||||
}*/
|
||||
|
||||
.noUi-handle:after {
|
||||
left: 17px;
|
||||
}
|
||||
|
||||
.noUi-vertical .noUi-handle:before,
|
||||
.noUi-vertical .noUi-handle:after {
|
||||
width: 14px;
|
||||
height: 1px;
|
||||
left: 6px;
|
||||
top: 14px;
|
||||
}
|
||||
|
||||
.noUi-vertical .noUi-handle:after {
|
||||
top: 17px;
|
||||
}
|
||||
|
||||
/* Disabled state;
|
||||
*/
|
||||
|
||||
[disabled] .noUi-connect {
|
||||
background: #B8B8B8;
|
||||
}
|
||||
|
||||
[disabled].noUi-target,
|
||||
[disabled].noUi-handle,
|
||||
[disabled] .noUi-handle {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Base;
|
||||
*
|
||||
*/
|
||||
.noUi-pips,
|
||||
.noUi-pips * {
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.noUi-pips {
|
||||
position: absolute;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* Values;
|
||||
*
|
||||
*/
|
||||
|
||||
.noUi-value {
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.noUi-value-sub {
|
||||
color: #ccc;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/* Markings;
|
||||
*
|
||||
*/
|
||||
|
||||
.noUi-marker {
|
||||
position: absolute;
|
||||
background: #e4e4e4;
|
||||
}
|
||||
|
||||
.noUi-marker-sub {
|
||||
background: #AAA;
|
||||
}
|
||||
|
||||
.noUi-marker-large {
|
||||
background: #e4e4e4;
|
||||
}
|
||||
|
||||
/* Horizontal layout;
|
||||
*
|
||||
*/
|
||||
|
||||
.noUi-pips-horizontal {
|
||||
padding: 10px 0;
|
||||
height: 35px;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.noUi-value-horizontal {
|
||||
-webkit-transform: translate(0, 17px);
|
||||
transform: translate(0, 17px);
|
||||
margin-left: -3px;
|
||||
}
|
||||
.noUi-pips-horizontal{
|
||||
.noUi-value-horizontal:last-child {
|
||||
-webkit-transform: translate(-100%, 17px);
|
||||
transform: translate(-100%, 17px);
|
||||
margin-left: 3px;
|
||||
}
|
||||
}
|
||||
.noUi-rtl .noUi-value-horizontal {
|
||||
-webkit-transform: translate(50%, 50%);
|
||||
transform: translate(50%, 50%);
|
||||
}
|
||||
|
||||
.noUi-marker-horizontal.noUi-marker {
|
||||
margin-left: -1px;
|
||||
width: 2px;
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
.noUi-marker-horizontal.noUi-marker-sub {
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.noUi-marker-horizontal.noUi-marker-large {
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
/* Vertical layout;
|
||||
*
|
||||
*/
|
||||
|
||||
.noUi-pips-vertical {
|
||||
padding: 0 10px;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.noUi-value-vertical {
|
||||
-webkit-transform: translate(0, -50%);
|
||||
transform: translate(0, -50%);
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.noUi-rtl .noUi-value-vertical {
|
||||
-webkit-transform: translate(0, 50%);
|
||||
transform: translate(0, 50%);
|
||||
}
|
||||
|
||||
.noUi-marker-vertical.noUi-marker {
|
||||
width: 5px;
|
||||
height: 2px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.noUi-marker-vertical.noUi-marker-sub {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.noUi-marker-vertical.noUi-marker-large {
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
.noUi-tooltip {
|
||||
display: block;
|
||||
position: absolute;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: #000;
|
||||
color: #fff;
|
||||
padding: 5px 6px;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.noUi-horizontal .noUi-tooltip {
|
||||
-webkit-transform: translate(-50%, 0);
|
||||
transform: translate(-50%, 0);
|
||||
left: 50%;
|
||||
bottom: 110%;
|
||||
}
|
||||
|
||||
.noUi-vertical .noUi-tooltip {
|
||||
-webkit-transform: translate(0, -50%);
|
||||
transform: translate(0, -50%);
|
||||
top: 50%;
|
||||
right: 120%;
|
||||
}
|
||||
/* hide pips options */
|
||||
.hide-pips{
|
||||
.noUi-pips{
|
||||
&.noUi-pips-horizontal{
|
||||
padding: 15px 0 0 0;
|
||||
}
|
||||
.noUi-value-horizontal{
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
.noUi-marker{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* always show tooltips */
|
||||
.tooltip-always-show{
|
||||
.noUi-handle{
|
||||
.noUi-tooltip{
|
||||
opacity:1;
|
||||
}
|
||||
}
|
||||
noUi-target.noUi-horizontal{
|
||||
margin-top:20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
/**
|
||||
* Olegnax Layered Navigation
|
||||
* Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
*/
|
||||
define([
|
||||
'jquery',
|
||||
'Magento_Theme/js/view/messages',
|
||||
'ko',
|
||||
'jquery-ui-modules/widget',
|
||||
'jquery-ui-modules/core',
|
||||
'oxFormValues'
|
||||
], function ($, messenger, ko) {
|
||||
'use strict';
|
||||
|
||||
$.widget('mage.OXAjaxNav', {
|
||||
options: {
|
||||
filterNavInputClass: '.block.filter .filter-options-content .item input[name^=filter]',
|
||||
filterClearAllClass: '.block.filter .filter-actions a.action.filter-clear',
|
||||
filterCurrentClass: '.block.filter .filter-current .item a.action',
|
||||
filters: [
|
||||
'.block.filter .filter-options-content .item a',
|
||||
'.block.filter .swatch-attribute a'
|
||||
],
|
||||
replaceSelectors: {
|
||||
leftnav: '.sidebar.sidebar-main .block.filter, [data-move-mobile="filtersslideout"] .block.filter.filters-slideout-content.ox-move-item',
|
||||
title: '.column.main .page-title-wrapper',
|
||||
breadcrumbs: '.column.main .breadcrumbs'
|
||||
},
|
||||
replaceContentSelectors: {
|
||||
products: '.column.main .search.results, .column.main'
|
||||
},
|
||||
clearUrl: null,
|
||||
timeout: 300,
|
||||
scrollToTop: true,
|
||||
loaderFilter: false,
|
||||
loaderContent: false,
|
||||
loaderPage: false,
|
||||
abortPrev: true,
|
||||
loaderContentSelector: '',
|
||||
selectedItemClass: 'ox-seleted-item'
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
this._loader_template_filter = '[data-role="ox-nav-loader-filter"]';
|
||||
this._loader_template_content = '[data-role="ox-nav-loader-content"]';
|
||||
this._loader_template_page = '[data-role="ox-nav-loader-page"]';
|
||||
this._loader_class_filter = '.ox-product-nav-filter';
|
||||
this._loader_class_content = '.ox-product-nav-content';
|
||||
this._loader_class_page = '.ox-product-nav-page';
|
||||
this._disable_class = 'ox-disable-ajax';
|
||||
this._current_count = '.filter-current-count';
|
||||
this._current_item = '.filter-current .item';
|
||||
this._use_url_class = 'ox-nav-use-url';
|
||||
this.timeoutID = null;
|
||||
|
||||
if (!this.options.clearUrl) {
|
||||
this.options.clearUrl = window.location.href;
|
||||
}
|
||||
this.afterUpdate();
|
||||
this._event();
|
||||
},
|
||||
/**
|
||||
* Set events
|
||||
* @private
|
||||
*/
|
||||
_event: function () {
|
||||
var _self = this;
|
||||
this.element.off('filter_apply.OXAjaxNav').on('filter_apply.OXAjaxNav', $.proxy(function (event, values, url) {
|
||||
var _url = url || this.options.clearUrl;
|
||||
this.getDebounceContent(_url, values);
|
||||
}, this));
|
||||
this.element.off('change.OXAjaxNav', this.options.filterNavInputClass).on('change.OXAjaxNav', this.options.filterNavInputClass, $.proxy(function (event) {
|
||||
var $this = $(event.currentTarget),
|
||||
values = _self.getAllFilter(),
|
||||
url;
|
||||
if ($this.hasClass(this._use_url_class)) {
|
||||
url = window.location.href;
|
||||
}
|
||||
$this.closest('li').eq(0).toggleClass(this.options.selectedItemClass, $this.prop('checked'));
|
||||
_self.element.trigger('filter_apply.OXAjaxNav', [values, url]);
|
||||
}, this));
|
||||
this.element.off('click.OXAjaxNav', this.options.filters.join(', ')).on('click.OXAjaxNav', this.options.filters.join(', '), $.proxy(function (event) {
|
||||
var $this = $(event.currentTarget).addClass(this.options.selectedItemClass),
|
||||
url = $this.attr('href');
|
||||
|
||||
if (url && !$this.hasClass(this._disable_class)) {
|
||||
event.preventDefault();
|
||||
var values = this._parseQueryString(url);
|
||||
_self.element.trigger('filter_apply.OXAjaxNav', values);
|
||||
}
|
||||
}, this));
|
||||
this.element.off('click.OXAjaxNav', this.options.filterCurrentClass).on('click.OXAjaxNav', this.options.filterCurrentClass, $.proxy(function (event) {
|
||||
var $this = $(event.currentTarget),
|
||||
url = $this.attr('href');
|
||||
|
||||
if (url && !$this.hasClass(this._disable_class)) {
|
||||
event.preventDefault();
|
||||
var values = this._parseQueryString(url);
|
||||
this.element.trigger('filter_apply.OXAjaxNav', values, url);
|
||||
}
|
||||
}, this));
|
||||
this.element.off('click.OXAjaxNav', this.options.filterClearAllClass).on('click.OXAjaxNav', this.options.filterClearAllClass, $.proxy(function (event) {
|
||||
var $this = $(event.currentTarget),
|
||||
url = $this.attr('href');
|
||||
|
||||
if (url && !$this.hasClass(this._disable_class)) {
|
||||
event.preventDefault();
|
||||
this.element.trigger('filter_apply.OXAjaxNav', null, url);
|
||||
}
|
||||
}, this));
|
||||
},
|
||||
/**
|
||||
* Update url current page
|
||||
* @param string url
|
||||
* @param object data
|
||||
*/
|
||||
updateUrl: function (url, data) {
|
||||
var _url = url || this.options.clearUrl,
|
||||
_data = data || {};
|
||||
|
||||
if (data.hasOwnProperty('navAjax')) {
|
||||
delete data.navAjax;
|
||||
}
|
||||
var new_url = new URL(_url);
|
||||
$.each(_data, function (i, v) {
|
||||
if (Array.isArray(v)) {
|
||||
new_url.searchParams.set(i, v.join(','));
|
||||
} else {
|
||||
new_url.searchParams.set(i, v);
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof history.replaceState === 'function') {
|
||||
history.replaceState(null, null, new_url.toString());
|
||||
}
|
||||
return new_url.toString();
|
||||
},
|
||||
/**
|
||||
* Get url attributes
|
||||
* @param string url
|
||||
* @return string
|
||||
* @private
|
||||
*/
|
||||
_parseQueryString: function (url) {
|
||||
return $.getURLValues(url);
|
||||
},
|
||||
getAllFilter: function () {
|
||||
var values = this.element.find(this.options.filterNavInputClass).getFormValues();
|
||||
if (values.hasOwnProperty('filter')) {
|
||||
values = values.filter;
|
||||
$.each(values, function (i, v) {
|
||||
if ('object' === typeof v) {
|
||||
var _v = [];
|
||||
$.each(v, function (i, v) {
|
||||
_v.push(v);
|
||||
});
|
||||
values[i] = _v.join(',');
|
||||
} else if (!values[i]) {
|
||||
delete values[i];
|
||||
}
|
||||
});
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
getDebounceContent: function (url, data, timeout) {
|
||||
var _url = url || this.options.clearUrl,
|
||||
_data = data || {},
|
||||
_timeout = timeout || this.options.timeout,
|
||||
_self = this;
|
||||
|
||||
clearTimeout(this.timeoutID);
|
||||
this.timeoutID = setTimeout(function () {
|
||||
_self.getContent.call(_self, _url, _data);
|
||||
}, _timeout);
|
||||
|
||||
},
|
||||
getContent: function (url, data) {
|
||||
this.startLoading();
|
||||
if (this.options.scrollToTop) {
|
||||
$(document).scrollTop(0);
|
||||
}
|
||||
var _url = url || this.options.clearUrl,
|
||||
_data = data || {},
|
||||
_self = this;
|
||||
this.current_filters = _data;
|
||||
_data['navAjax'] = 1;
|
||||
|
||||
var timestamp = new Date().getTime();
|
||||
this.lastTimestamp = timestamp;
|
||||
if (this.options.abortPrev && this.xhr)
|
||||
this.xhr.abort();
|
||||
this.xhr = $.ajax({
|
||||
url: _url,
|
||||
data: _data,
|
||||
cache: true,
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
if (_self.lastUpdate && _self.lastUpdate > timestamp)
|
||||
return;
|
||||
_self.lastUpdate = timestamp;
|
||||
if (response.hasOwnProperty('html')) {
|
||||
_self.replaceHTML(response.html);
|
||||
} else {
|
||||
if (response.hasOwnProperty('msg')) {
|
||||
_self.setMessage({
|
||||
type: 'error',
|
||||
text: response.msg
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.lastTimestamp > timestamp)
|
||||
return;
|
||||
_self.updateUrl(_url, data);
|
||||
_self.afterUpdate();
|
||||
_self.element.trigger('filter_applied.OXAjaxNav', response);
|
||||
$('body').trigger('contentUpdated').trigger('OxInfiniteScroll');
|
||||
_self.stopLoading();
|
||||
},
|
||||
error: function (response) {
|
||||
_self.element.trigger('filter_error.OXAjaxNav', response);
|
||||
_self.setMessage({
|
||||
type: 'error',
|
||||
text: 'Sorry, something went wrong. Please try again later.'
|
||||
});
|
||||
window.location = _self.updateUrl(_url, data);
|
||||
}
|
||||
});
|
||||
},
|
||||
setMessage: function (obj) {
|
||||
messenger().messages({
|
||||
messages: ko.observableArray([obj])
|
||||
});
|
||||
},
|
||||
_createLoader: function (loader, parent) {
|
||||
if (!this.hasOwnProperty('_loader_class_' + loader)) {
|
||||
return;
|
||||
}
|
||||
var parent = parent || 'body',
|
||||
$parent = $(parent),
|
||||
$loader = $parent.children(this['_loader_class_' + loader]);
|
||||
if (!$loader.length) {
|
||||
var content = $(this['_loader_template_' + loader]).html();
|
||||
$(content).prependTo($parent);
|
||||
$loader = $parent.children(this['_loader_class_' + loader]);
|
||||
}
|
||||
return $loader;
|
||||
},
|
||||
|
||||
startLoading: function () {
|
||||
if (this.options.loaderFilter) {
|
||||
this._createLoader('filter', this.options.replaceSelectors.leftnav).show();
|
||||
}
|
||||
if (this.options.loaderContent && this.options.loaderContentSelector) {
|
||||
this._createLoader('content', this.options.loaderContentSelector).show();
|
||||
}
|
||||
if (this.options.loaderPage) {
|
||||
this._createLoader('page').show();
|
||||
}
|
||||
},
|
||||
stopLoading: function () {
|
||||
if (this.options.loaderFilter) {
|
||||
this._createLoader('filter', this.options.replaceSelectors.leftnav).hide();
|
||||
}
|
||||
if (this.options.loaderContent && this.options.loaderContentSelector) {
|
||||
this._createLoader('content', this.options.loaderContentSelector).hide();
|
||||
}
|
||||
if (this.options.loaderPage) {
|
||||
this._createLoader('page').hide();
|
||||
}
|
||||
},
|
||||
replaceHTML: function (data) {
|
||||
$.each(data, $.proxy(function (key, html) {
|
||||
if (this.options.replaceSelectors.hasOwnProperty(key)) {
|
||||
var $element = $(this.options.replaceSelectors[key]);
|
||||
|
||||
if ($element.length) {
|
||||
$element.replaceWith(html);
|
||||
$element.trigger('contentUpdated');
|
||||
}
|
||||
} else if ('_before' === key || '_after' === key) {
|
||||
if ('_before' === key && html) {
|
||||
$(this.options.replaceContentSelectors.products).before(html);
|
||||
} else if (html) {
|
||||
$(this.options.replaceContentSelectors.products).after(html);
|
||||
}
|
||||
} else if (html) {
|
||||
var $elementParent;
|
||||
if (this.options.replaceContentSelectors.hasOwnProperty(key)) {
|
||||
$elementParent = $(this.options.replaceContentSelectors[key]).last();
|
||||
}
|
||||
var createSelector = function (a) {
|
||||
if (!a.prop('tagName'))
|
||||
return;
|
||||
var _id = a.attr('id') || '',
|
||||
_class = (a.attr('class') || '').replace(/\s+/g, ' ').replace(/ /g, '.'),
|
||||
_selector = a.prop('tagName') + (_id ? '#' + _id : '') + (_class ? '.' + _class : '');
|
||||
return _selector;
|
||||
};
|
||||
var items = {},
|
||||
parent,
|
||||
first = true,
|
||||
prevElement;
|
||||
$(html).each(function () {
|
||||
var $html = $(this),
|
||||
selector = createSelector($html);
|
||||
if (!selector)
|
||||
return;
|
||||
if (/^script/i.test(selector)) {
|
||||
$elementParent.append($html);
|
||||
return;
|
||||
}
|
||||
var $element = $(selector);
|
||||
if ($elementParent.length) {
|
||||
$element = $elementParent.find(selector);
|
||||
}
|
||||
if (0 < $element.length) {
|
||||
if (1 == $element.length) {
|
||||
$element.replaceWith($html);
|
||||
prevElement = selector;
|
||||
} else {
|
||||
var $element = $(prevElement);
|
||||
if ($elementParent.length) {
|
||||
$element = $elementParent.find(prevElement);
|
||||
}
|
||||
$element = $element.next(selector);
|
||||
if (0 < $element.length) {
|
||||
$element.replaceWith($html);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$elementParent.append($html);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, this));
|
||||
},
|
||||
afterUpdate: function () {
|
||||
var count = $(this._current_item).length;
|
||||
$(this._current_count).html(count ? count : "");
|
||||
$(this.options.replaceSelectors.leftnav).data('moveDesktopParent', $('.sidebar.sidebar-main').eq(0));
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return $.mage.OXAjaxNav;
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
define([
|
||||
'jquery',
|
||||
], function ($) {
|
||||
'use strict';
|
||||
$.getValues = function (query) {
|
||||
var query = query || '',
|
||||
vars = query.split('&'),
|
||||
result = {},
|
||||
getName = function (name) {
|
||||
var regex;
|
||||
|
||||
if ((regex = /^(.+?)\[(.*?)$/).test(name)) {
|
||||
name = name.match(regex);
|
||||
name[2] = name[2].replace(/\]/g, '').split('[');
|
||||
name[2].unshift(name[1]);
|
||||
name = name[2].map(function (v) {
|
||||
return '' === v ? 0 : v;
|
||||
});
|
||||
} else {
|
||||
name = [name];
|
||||
}
|
||||
|
||||
return name;
|
||||
},
|
||||
setValue = function (form, names, value) {
|
||||
var name = names.shift();
|
||||
|
||||
if (names.length) {
|
||||
var _form = form.hasOwnProperty(name) ? form[name] : {};
|
||||
form[name] = setValue(_form, names, value);
|
||||
} else {
|
||||
if (0 === name) {
|
||||
for (; form.hasOwnProperty(name); name++) {
|
||||
}
|
||||
}
|
||||
form[name] = value;
|
||||
}
|
||||
|
||||
return form
|
||||
};
|
||||
for (var i = 0; i < vars.length; i++)
|
||||
if (vars[i].length) {
|
||||
var pair = vars[i].split('=').map(decodeURIComponent);
|
||||
result = setValue(result, getName(pair[0]), pair[1]);
|
||||
}
|
||||
|
||||
return $.extend(true, {}, result);
|
||||
|
||||
};
|
||||
$.getURLValues = function (href) {
|
||||
var href = href || window.location.href,
|
||||
url = new URL(href);
|
||||
return $.getValues(url.search.replace(/^\?/, ''));
|
||||
};
|
||||
|
||||
$.fn.getFormValues = function () {
|
||||
return $.getValues($(this).serialize());
|
||||
};
|
||||
|
||||
return $.fn.getFormValues;
|
||||
});
|
||||
+2
File diff suppressed because one or more lines are too long
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* Olegnax Layered Navigation - Price Slider
|
||||
* Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
*/
|
||||
define([
|
||||
'jquery',
|
||||
'noUiSlider',
|
||||
'wNumb',
|
||||
'jquery-ui-modules/core',
|
||||
'jquery-ui-modules/widget',
|
||||
], function ($, noUiSlider, wNumb) {
|
||||
'use strict';
|
||||
|
||||
$.widget('mage.OXPriceSlider', {
|
||||
options: {
|
||||
//slider
|
||||
animate: true,
|
||||
min: 0,
|
||||
max: 100,
|
||||
current: null,
|
||||
step: 1,
|
||||
//format
|
||||
formatMoney: {
|
||||
decimals: 2
|
||||
},
|
||||
//html
|
||||
class_slider: ".ox-price-slider",
|
||||
class_value: "input[name='filter[price]']",
|
||||
class_label_scale: ".ox-price-filter__values",
|
||||
class_label: ".ox-price-filter__selected",
|
||||
class_from_label: ".ox-slider-from",
|
||||
class_to_label: ".ox-slider-to",
|
||||
|
||||
},
|
||||
_create: function () {
|
||||
this.slider_element = this.element.find(this.options.class_slider);
|
||||
this.value_element = this.element.find(this.options.class_value);
|
||||
this.label_element = this.element.find(this.options.class_label);
|
||||
this.min_label_element = this.label_element.find(this.options.class_from_label);
|
||||
this.max_label_element = this.label_element.find(this.options.class_to_label);
|
||||
|
||||
var values = this.value_element.val();
|
||||
values = values ? values.split('-').map(parseFloat) : null;
|
||||
|
||||
this.options.min = parseFloat(this.options.min);
|
||||
this.options.max = parseFloat(this.options.max);
|
||||
this.options.step = parseFloat(this.options.step);
|
||||
this.options.current = this.options.current || values || [this.options.min, this.options.max];
|
||||
|
||||
this.element.find('input').hide();
|
||||
|
||||
this.slider_element.show();
|
||||
this.wNumb = wNumb(this.options.formatMoney);
|
||||
var slider = this.slider_element[0];
|
||||
|
||||
|
||||
noUiSlider.create(slider, {
|
||||
start: this.options.current,
|
||||
step: 1,
|
||||
connect: true,
|
||||
range: {
|
||||
'min': this.options.min,
|
||||
'max': this.options.max
|
||||
},
|
||||
tooltips: [true, this.wNumb],
|
||||
pips: {
|
||||
mode: 'positions',
|
||||
values: [0, 100],
|
||||
density: 4,
|
||||
format: this.wNumb
|
||||
}
|
||||
});
|
||||
this.sliderCreate();
|
||||
slider.noUiSlider.on('change.OXPriceSlider', $.proxy(this.sliderChange, this));
|
||||
},
|
||||
sliderCreate: function () {
|
||||
this.change_label(this.options.current);
|
||||
this.element.trigger('price_slider_create', this.options.current);
|
||||
},
|
||||
sliderSlide: function (values) {
|
||||
this.change(values, 'price_slider_slide');
|
||||
},
|
||||
sliderChange: function (values) {
|
||||
this.change(values, 'price_slider_change');
|
||||
},
|
||||
change: function (values, event) {
|
||||
this.change_value(values, 'price_slider_change' === event);
|
||||
this.change_label(values);
|
||||
if ('string' == typeof event && event) {
|
||||
this.element.trigger(event, values);
|
||||
}
|
||||
},
|
||||
change_value: function (values, run) {
|
||||
values = values.join('-');
|
||||
this.value_element.val(values);
|
||||
if (run) {
|
||||
this.value_element.trigger('change');
|
||||
}
|
||||
},
|
||||
|
||||
change_label: function (values) {
|
||||
this.min_label_element.html(this.wNumb.to(values[0]));
|
||||
this.max_label_element.html(this.wNumb.to(values[1]));
|
||||
this.label_element.show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return $.mage.OXPriceSlider;
|
||||
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
define([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
'use strict';
|
||||
|
||||
return function (widget) {
|
||||
$.widget('mage.SwatchRenderer', widget, {
|
||||
_RenderControls: function () {
|
||||
var container = this.element,
|
||||
classes = this.options.classes;
|
||||
if (container.find('.' + classes.attributeClass).length) {
|
||||
return;
|
||||
}
|
||||
return this._super();
|
||||
}
|
||||
});
|
||||
|
||||
return $.mage.SwatchRenderer;
|
||||
}
|
||||
});
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():window.wNumb=e()}(function(){"use strict";var o=["decimals","thousand","mark","prefix","suffix","encoder","decoder","negativeBefore","negative","edit","undo"];function w(e){return e.split("").reverse().join("")}function h(e,t){return e.substring(0,t.length)===t}function f(e,t,n){if((e[t]||e[n])&&e[t]===e[n])throw new Error(t)}function x(e){return"number"==typeof e&&isFinite(e)}function n(e,t,n,r,i,o,f,u,s,c,a,p){var d,l,h,g=p,v="",m="";return o&&(p=o(p)),!!x(p)&&(!1!==e&&0===parseFloat(p.toFixed(e))&&(p=0),p<0&&(d=!0,p=Math.abs(p)),!1!==e&&(p=function(e,t){return e=e.toString().split("e"),(+((e=(e=Math.round(+(e[0]+"e"+(e[1]?+e[1]+t:t)))).toString().split("e"))[0]+"e"+(e[1]?e[1]-t:-t))).toFixed(t)}(p,e)),-1!==(p=p.toString()).indexOf(".")?(h=(l=p.split("."))[0],n&&(v=n+l[1])):h=p,t&&(h=w((h=w(h).match(/.{1,3}/g)).join(w(t)))),d&&u&&(m+=u),r&&(m+=r),d&&s&&(m+=s),m+=h,m+=v,i&&(m+=i),c&&(m=c(m,g)),m)}function r(e,t,n,r,i,o,f,u,s,c,a,p){var d,l="";return a&&(p=a(p)),!(!p||"string"!=typeof p)&&(u&&h(p,u)&&(p=p.replace(u,""),d=!0),r&&h(p,r)&&(p=p.replace(r,"")),s&&h(p,s)&&(p=p.replace(s,""),d=!0),i&&function(e,t){return e.slice(-1*t.length)===t}(p,i)&&(p=p.slice(0,-1*i.length)),t&&(p=p.split(t).join("")),n&&(p=p.replace(n,".")),d&&(l+="-"),""!==(l=(l+=p).replace(/[^0-9\.\-.]/g,""))&&(l=Number(l),f&&(l=f(l)),!!x(l)&&l))}function i(e,t,n){var r,i=[];for(r=0;r<o.length;r+=1)i.push(e[o[r]]);return i.push(n),t.apply("",i)}return function e(t){if(!(this instanceof e))return new e(t);"object"==typeof t&&(t=function(e){var t,n,r,i={};for(void 0===e.suffix&&(e.suffix=e.postfix),t=0;t<o.length;t+=1)if(void 0===(r=e[n=o[t]]))"negative"!==n||i.negativeBefore?"mark"===n&&"."!==i.thousand?i[n]=".":i[n]=!1:i[n]="-";else if("decimals"===n){if(!(0<=r&&r<8))throw new Error(n);i[n]=r}else if("encoder"===n||"decoder"===n||"edit"===n||"undo"===n){if("function"!=typeof r)throw new Error(n);i[n]=r}else{if("string"!=typeof r)throw new Error(n);i[n]=r}return f(i,"mark","thousand"),f(i,"prefix","negative"),f(i,"prefix","negativeBefore"),i}(t),this.to=function(e){return i(t,n,e)},this.from=function(e){return i(t,r,e)})}});
|
||||
Reference in New Issue
Block a user