init
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
<script>
|
||||
require([
|
||||
"jquery",
|
||||
], function($){
|
||||
$(document).ready(function () {
|
||||
$(document).on('click', '.filter-options-item .filter-options-title', function() {
|
||||
var that = this;
|
||||
$('.filter-options-item.active > .filter-options-title').each(function(key, value) {
|
||||
if (that != value) {
|
||||
$(value).parent().removeClass('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
// @codingStandardsIgnoreFile
|
||||
?>
|
||||
|
||||
<?php $attributeId = $block->getAttributeId()?>
|
||||
<?php $isMulti = $block->getIsMultiselect()?>
|
||||
<?php $canShowQty = (is_null($block->getShowQty())) ? $this->helper('\Magento\Catalog\Helper\Data')->shouldDisplayProductCountOnLayer() : $block->getShowQty();?>
|
||||
<?php $canShowInstantSearch = $block->canShowInstantSearch() ? 'desktop' : ''?>
|
||||
<?php $canShowInstantSearchMobile = $block->canShowInstantSearchMobile() ? 'mobile' : ''?>
|
||||
<?php $categoryParamLabel = $block->getCategoryParamLabel()?>
|
||||
<?php $ratingParamLabel = $block->getRatingParamLabel()?>
|
||||
|
||||
<?php
|
||||
$listItemStyle = 'display: none';
|
||||
if ($attributeId == \WeltPixel\LayeredNavigation\Helper\Data::RATING_PARAM_LABEL) {
|
||||
$listItemStyle = '';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wp-instant-search-wrapper <?= $block->escapeHtmlAttr($canShowInstantSearchMobile) ?> <?= $block->escapeHtmlAttr($canShowInstantSearch) ?>">
|
||||
<input type="text" class="wp-instant-search-inp" id="instant_search_<?= $block->escapeHtmlAttr($attributeId) ?>" data-attr-id="<?= $block->escapeHtmlAttr($attributeId) ?>" placeholder="<?= $block->escapeHtmlAttr(__('Search for options ...')) ?>">
|
||||
</div>
|
||||
|
||||
|
||||
<ol class="items" id="<?= $block->escapeHtmlAttr($attributeId) ?>_items" >
|
||||
<?php foreach ($filterItems as $filterItem): ?>
|
||||
<?php $requestVar = $filterItem->getFilter()->getRequestVar();?>
|
||||
<?php $filterItemVal = is_array($filterItem->getValue()) ? implode('-', $filterItem->getValue()) : $filterItem->getValue()?>
|
||||
<?php $idAddOn = $attributeId?>
|
||||
<?php if($requestVar == $categoryParamLabel):?>
|
||||
<?php $dataOptPath = $categoryParamLabel.'='.$filterItemVal;?>
|
||||
<?php elseif($requestVar == $ratingParamLabel):?>
|
||||
<?php $dataOptPath = $ratingParamLabel.'='.$filterItemVal;?>
|
||||
<?php $idAddOn = $ratingParamLabel?>
|
||||
<?php else:?>
|
||||
<?php $dataOptPath = $filterItem->getFilter()->getAttributeModel()->getAttributeCode().'='. $filterItemVal;?>
|
||||
<?php endif;?>
|
||||
<li class="item" style="<?= $block->escapeHtmlAttr($listItemStyle) ?>" id="wp_ln_attr_<?= $block->escapeHtmlAttr($idAddOn) ?>_<?= $block->escapeHtmlAttr(is_array($filterItem->getValue()) ? implode('-', $filterItem->getValue()) : $filterItem->getValue()) ?>">
|
||||
<?php if ($filterItem->getCount() > 0): $filter = $filterItem->getFilter();?>
|
||||
<a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>"
|
||||
data-opt-path="<?= $block->escapeHtmlAttr($dataOptPath) ?>"
|
||||
data-is-multi="<?= /* @noEscape */ $isMulti ?>">
|
||||
<?= /* @noEscape */ $filterItem->getLabel() ?>
|
||||
<?php if ($canShowQty): ?>
|
||||
<span class="count"><?= /* @noEscape */ $filterItem->getCount() ?><span class="filter-count-label">
|
||||
<?php if ($filterItem->getCount() == 1):?> <?= /* @noEscape */ __('item') ?><?php else:?> <?= /* @noEscape */ __('items') ?><?php endif;?></span></span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php else:?>
|
||||
<a href="#" class="wp-filter-disabled" disabled="disabled"><?= /* @noEscape */ $filterItem->getLabel() ?></a>
|
||||
<?php if ($canShowQty): ?>
|
||||
<span class="count"><?= /* @noEscape */ $filterItem->getCount() ?><span class="filter-count-label">
|
||||
<?php if ($filterItem->getCount() == 1):?><?= /* @noEscape */ __('item') ?><?php else:?><?= /* @noEscape */ __('items') ?><?php endif;?></span></span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
<?php if($requestVar != $ratingParamLabel):?>
|
||||
<div class="wp-ln-actions" data-visibleItems="<?= /* @noEscape */ (int) $block->getVisibleItems() ?>" data-visibleItemsStep="<?= /* @noEscape */ (int) $block->getVisibleItemsStep() ?>" data-attrId="<?= $block->escapeHtmlAttr($attributeId) ?>">
|
||||
<b id="showLess_<?= /* @noEscape */ $attributeId?>" class="wp-ln-action wp-ln-show-less icon-line-arrow-up"></b>
|
||||
<b id="loadMore_<?= /* @noEscape */ $attributeId?>" class="wp-ln-action wp-ln-load-more icon-line-arrow-down"></b>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</ol>
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
<?php $priceData = $this->getPriceConfigData()?>
|
||||
<?php $priceIsInputType = $this->priceIsInputType()?>
|
||||
<div id="slider-range"></div>
|
||||
<div class="wp-slider-inp">
|
||||
<div class="wp-slider-inp-range">
|
||||
<?php if($priceIsInputType): ?>
|
||||
<input type="text" id="amount_from" class="wp-price-slider-inp inp-type" />
|
||||
<?php else : ?>
|
||||
<label for="amount"><?= $block->escapeHtml(__('Price:'))?></label>
|
||||
<div class="price-value-wrapper">
|
||||
<span class="wp-slider-currency"><?= $block->escapeHtml($priceData['currency']) ?></span>
|
||||
<span id="amount_from" class="wp-price-slider-inp"></span>
|
||||
<?php endif;?>
|
||||
|
||||
<span class="wp-slider-range-separator">-</span>
|
||||
|
||||
<?php if($priceIsInputType): ?>
|
||||
<input type="text" id="amount_to" class="wp-price-slider-inp inp-type" />
|
||||
<?php else : ?>
|
||||
<span class="wp-slider-currency"><?= $block->escapeHtml($priceData['currency']) ?></span>
|
||||
<span id="amount_to" class="wp-price-slider-inp"></span>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<a href="<?= $block->escapeUrl($this->getSliderApplyUrl()) ?>" class="wp-price-slider-a" id="wp_ln_price_slider"><?= $block->escapeHtml(__('Apply')) ?></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
require(['jquery','jquery-ui-modules/effect-slide','jquery-ui-modules/mouse','jquery-ui-modules/widget','<?= $block->escapeJs($block->getSliderJsWidget()) ?>','jqueryTouch'], function($){
|
||||
$( function() {
|
||||
var priceIsInputType = <?= $priceIsInputType ? 'true': 'false'?>;
|
||||
var priceSearchArr = getPriceParam();
|
||||
var priceSearchMinInp = (priceSearchArr) ? priceSearchArr[0] : <?= /* @noEscape */ $priceData['min']?>;
|
||||
var priceSearchMaxInp = (priceSearchArr) ? priceSearchArr[1] : <?= /* @noEscape */ $priceData['max']?>;
|
||||
$("#slider-range").slider({
|
||||
range: true,
|
||||
min: <?= /* @noEscape */ $priceData['minX']?>,
|
||||
max: <?= /* @noEscape */ $priceData['maxX']?>,
|
||||
step: <?= /* @noEscape */ $priceData['step']?>,
|
||||
values: [ priceSearchMinInp , priceSearchMaxInp ],
|
||||
slide: function( event, ui ) {
|
||||
if(priceIsInputType) {
|
||||
$("#amount_from").val(ui.values[0]);
|
||||
$("#amount_to").val(ui.values[1]);
|
||||
} else {
|
||||
$("#amount_from").text(ui.values[0]);
|
||||
$("#amount_to").text(ui.values[1]);
|
||||
}
|
||||
|
||||
var priceParam = 'price=' + ui.values[0] + '-' + ui.values[1],
|
||||
link = window.location.href,
|
||||
cleanLink = removeParam('price', removeParam('p', link)),
|
||||
sliderLink = cleanLink + getSeparator(cleanLink) +priceParam;
|
||||
$('#wp_ln_price_slider').attr('href', sliderLink);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(priceIsInputType) {
|
||||
$("#amount_from" ).val($( "#slider-range" ).slider( "values", 0 ));
|
||||
$('#amount_to').val($( "#slider-range" ).slider( "values", 1 ));
|
||||
} else {
|
||||
$("#amount_from" ).text($( "#slider-range" ).slider( "values", 0 ));
|
||||
$('#amount_to').text($( "#slider-range" ).slider( "values", 1 ));
|
||||
}
|
||||
|
||||
$('.wp-price-slider-inp').on('keyup', function() {
|
||||
var minPrice = (priceIsInputType) ? $("#amount_from" ).val() : $("#amount_from" ).text(),
|
||||
maxPrice = (priceIsInputType) ? $("#amount_to" ).val() :$("#amount_to" ).text(),
|
||||
cleanLink = removeParam('price', removeParam('p', window.location.href)),
|
||||
priceParam = 'price=' + minPrice + '-' + maxPrice,
|
||||
sliderLink = cleanLink + getSeparator(cleanLink) + priceParam;
|
||||
$('#wp_ln_price_slider').attr('href', sliderLink);
|
||||
});
|
||||
|
||||
/** get parameter separator from link*/
|
||||
function getSeparator(link) {
|
||||
var sep = link.indexOf('?');
|
||||
if(sep !== -1) {
|
||||
return '&';
|
||||
}
|
||||
|
||||
return '?';
|
||||
}
|
||||
|
||||
/** remove existing 'price' parameter from url */
|
||||
function removeParam(key, url) {
|
||||
if (!url) url = window.location.href;
|
||||
var hashParts = url.split('#'),
|
||||
regex = new RegExp("([?&])" + key + "=.*?(&|#|$)", "i");
|
||||
|
||||
if (hashParts[0].match(regex)) {
|
||||
url = hashParts[0].replace(regex, '$1');
|
||||
url = url.replace(/([?&])$/, '');
|
||||
if (typeof hashParts[1] !== 'undefined' && hashParts[1] !== null)
|
||||
url += '#' + hashParts[1];
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
/** get 'price' parameter value from link */
|
||||
function getPriceParam() {
|
||||
var priceArr = false;
|
||||
|
||||
var params = parseQueryString();
|
||||
var price = params['price'];
|
||||
if(price) {
|
||||
var priceArr = price.split("-");
|
||||
|
||||
}
|
||||
|
||||
return priceArr;
|
||||
}
|
||||
|
||||
function parseQueryString(){
|
||||
var str = window.location.search;
|
||||
var objURL = {};
|
||||
|
||||
str.replace(
|
||||
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
|
||||
function( $0, $1, $2, $3 ){
|
||||
objURL[ $1 ] = $3;
|
||||
}
|
||||
);
|
||||
return objURL;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
// @codingStandardsIgnoreFile
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Category layered navigation state
|
||||
*
|
||||
* @var $block \WeltPixel\LayeredNavigation\Block\Navigation\State
|
||||
*/
|
||||
?>
|
||||
<?php $_filters = $block->getActiveFilters() ?>
|
||||
<?php $categoryParamLabel = $block->getCategoryParamLabel()?>
|
||||
<?php $ratingParamLabel = $block->getRatingParamLabel()?>
|
||||
<?php if (!empty($_filters)): ?>
|
||||
<div id="wp_ln_shopby" class="filter-current" data-mage-init='{"collapsible":{"openedState": "active", "collapsible": true, "active": true }}'>
|
||||
<strong class="block-subtitle filter-current-subtitle"
|
||||
role="heading"
|
||||
data-role="title"
|
||||
aria-level="2"
|
||||
data-count="<?= /* @noEscape */ count($_filters) ?>"><?= $block->escapeHtml(__('Now Shopping by')) ?>
|
||||
</strong>
|
||||
<div class="items" id="wp_ln_shopby_items" data-role="content">
|
||||
<?php foreach ($_filters as $_filter): ?>
|
||||
<?php
|
||||
$requestVar = $_filter->getFilter()->getRequestVar();
|
||||
$filterItemVal = (is_array($_filter->getValue())) ? implode('-', $_filter->getValue()) : $_filter->getValue();
|
||||
if ($requestVar == $categoryParamLabel) {
|
||||
$dataAttrId = '0_' . $filterItemVal;
|
||||
$filterLabel = $block->stripTags($_filter->getLabel());
|
||||
} elseif ($requestVar == $ratingParamLabel) {
|
||||
$dataAttrId = $ratingParamLabel . '_' . $filterItemVal;
|
||||
$filterLabel = $block->getRateFilterLabel($_filter);
|
||||
} else {
|
||||
$dataAttrId = $_filter->getFilter()->getAttributeModel()->getAttributeId() . '_' . $filterItemVal;
|
||||
$filterLabel = $block->stripTags($_filter->getLabel());
|
||||
}
|
||||
?>
|
||||
<li class="item" data-attr-id="<?= $block->escapeHtmlAttr($dataAttrId) ?>">
|
||||
<span class="filter-label"><?= $block->escapeHtml(__($_filter->getName())) ?></span>
|
||||
<span class="filter-value"><?= $block->escapeHtml($filterLabel) ?></span>
|
||||
<?php
|
||||
$clearLinkUrl = $_filter->getClearLinkUrl();
|
||||
$currentFilterName = $block->escapeHtml(__($_filter->getName())) . " " . $block->stripTags($_filter->getLabel());
|
||||
if ($clearLinkUrl):
|
||||
?>
|
||||
<a class="action previous" href="<?= $block->escapeUrl($_filter->getRemoveUrl()) ?>"
|
||||
title="<?= $block->escapeHtmlAttr(__('Previous')) ?>">
|
||||
<span><?= $block->escapeHtml(__('Previous')) ?></span>
|
||||
</a>
|
||||
<a class="action remove"
|
||||
title="<?= $block->escapeHtmlAttr($_filter->getFilter()->getClearLinkText()) ?>"
|
||||
href="<?= $block->escapeUrl($clearLinkUrl) ?>">
|
||||
<span><?= $block->escapeHtml($_filter->getFilter()->getClearLinkText()) ?></span>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="action remove" href="<?= $block->escapeUrl($_filter->getRemoveUrl()) ?>"
|
||||
title="<?= $block->escapeHtmlAttr(__('Remove') . ' ' . $currentFilterName) ?>">
|
||||
<span><?= $block->escapeHtml(__('Remove This Item')) ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
+279
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
// @codingStandardsIgnoreFile
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Category layered navigation
|
||||
*
|
||||
* @var $block WeltPixel\LayeredNavigation\Block\Navigation
|
||||
*/
|
||||
|
||||
$_helper = $this->helper('\WeltPixel\LayeredNavigation\Helper\Data');
|
||||
$isAjaxMode = $block->isAjaxMode();
|
||||
$isAutoClose = $block->isAutoClose();
|
||||
$isAjaxScrollToTopClass = ($block->isAjaxScrollToTop()) ? 'ajax-scroll-top' : '';
|
||||
$isAutoCloseClass = ($isAutoClose) ? 'auto-close' : 'manual-close';
|
||||
$jsClass = ($isAjaxMode) ? 'WeltPixel_LayeredNavigation/js/product/list/toolbar' : false;
|
||||
|
||||
/* Horizontal Sidebar Design Settings */
|
||||
$sidebarStyle = $_helper->getSidebarStyle();
|
||||
$selectedFilters = $_helper->getSelectedFiltersOptions();
|
||||
$horizontalBoxShadow = $_helper->getHorizontalBoxShadow();
|
||||
$horizontalSbDesignVersion = ($sidebarStyle === '3' ? $_helper->getHorizontalSidebarDesignVersion() : '');
|
||||
$filterPosition = ($horizontalSbDesignVersion === 'v2' ? $_helper->getHorizontalSidebarFilterPosition() : '');
|
||||
$reverseOrderClass = ($horizontalSbDesignVersion === 'v2' ? 'reverse-order' : '');
|
||||
$horizontalDesignClass = ($horizontalSbDesignVersion === '' ? '' : 'horizontal-' . $horizontalSbDesignVersion);
|
||||
$filterAlignmentClass = ($horizontalSbDesignVersion === 'v2' ? 'filter-align-' . $filterPosition : '');
|
||||
$selectedFiltersClass = ($selectedFilters === '1' ? 'show-selected-filters' : 'hide-selected-filters');
|
||||
$horizontalBoxShadowClass = ($sidebarStyle === '2' && $horizontalBoxShadow === '1' ? '' : 'no-box-shadow');
|
||||
|
||||
/* Horizontal Sidebar Design V3 Settings */
|
||||
$filtersBorder = ($_helper->getHorizontalFiltersBorder() ? $_helper->getHorizontalFiltersBorder() : '');
|
||||
$filtersBorderRadius = ($_helper->getHorizontalFiltersBorderRadius() ? $_helper->getHorizontalFiltersBorderRadius() : '');
|
||||
$filterButtonColor = ($horizontalSbDesignVersion === 'v3' ? $_helper->getHorizontalV3FiltersButtonColor() : '');
|
||||
$filterTextColor = ($horizontalSbDesignVersion === 'v3' ? $_helper->getHorizontalV3FiltersTextColor() : '');
|
||||
$filterButtonHoverColor = ($horizontalSbDesignVersion === 'v3' ? $_helper->getHorizontalV3FiltersButtonHoverColor() : '');
|
||||
$filterTextHoverColor = ($horizontalSbDesignVersion === 'v3' ? $_helper->getHorizontalV3FiltersTextHoverColor() : '');
|
||||
$filtersBorderColor = ($_helper->getHorizontalFiltersBorderColor() ? $_helper->getHorizontalFiltersBorderColor() : '');
|
||||
$isMultiSelectOptionDisplayEnabled = $_helper->displayMultiselectAttributeSelectedOptions();
|
||||
|
||||
/* Sticky Filters */
|
||||
$mobileBreakpoint = ($_helper->getMobileThreshold() === '' ? '768' : $_helper->getMobileThreshold());
|
||||
$isStickyFiltersEnabled = ($horizontalSbDesignVersion === 'v2' ? $_helper->isHorizontalSidebarStickyEnabled() : '0');
|
||||
|
||||
?>
|
||||
<div class="wp-filters <?php if ($isAjaxMode) echo 'wp-filters-ajax' ?>">
|
||||
<?= /* @noEscape */
|
||||
$block->getFilterButtonHtml() ?>
|
||||
</div>
|
||||
<?php if ($block->canShowBlock()): ?>
|
||||
<div class="block filter <?= $block->escapeHtmlAttr($isAjaxScrollToTopClass) ?> <?= $block->escapeHtmlAttr($horizontalBoxShadowClass) ?> <?= $block->escapeHtmlAttr($isAutoCloseClass) ?> <?= $block->escapeHtmlAttr($horizontalDesignClass) ?> <?= $block->escapeHtmlAttr($filterAlignmentClass) ?> <?= $block->escapeHtmlAttr($selectedFiltersClass) ?>" id="layered-filter-block"
|
||||
data-mage-init='<?= /* @noEscape */ json_encode(["collapsible"=>["openedState"=>"active","collapsible"=>true,"active"=>false,"collateral"=>["openedState"=>"filter-active","element"=>"body"]]]) ?>'>
|
||||
<?php $filtered = count($block->getLayer()->getState()->getFilters()) ?>
|
||||
<div class="block-title filter-title" data-count="<?= /* @noEscape */
|
||||
$filtered ?>">
|
||||
<strong data-role="title"><?= /* @noEscape */
|
||||
__('Shop By') ?></strong>
|
||||
</div>
|
||||
<div class="block-content filter-content <?= /* @noEscape */ $reverseOrderClass ?>">
|
||||
<?php if ($horizontalSbDesignVersion === 'v2') : ?>
|
||||
<div class="filter-actions-wrapper">
|
||||
<?php endif; ?>
|
||||
<?= $block->getChildHtml('state') ?>
|
||||
<?php if ($block->getLayer()->getState()->getFilters()): ?>
|
||||
<div class="block-actions filter-actions">
|
||||
<a href="<?= $block->escapeUrl($block->getClearUrl()) ?>" class="action clear filter-clear"><span><?= $block->escapeHtml(__('Clear All')) ?></span></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($horizontalSbDesignVersion === 'v2') : ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php $activeFilters = $block->getActiveFilters() ?>
|
||||
<?php $wrapOptions = false; ?>
|
||||
<?php foreach ($block->getFilters() as $k => $filter): ?>
|
||||
<?php $filterAttributeId = $filter->getData('attribute_model') ? $filter->getData('attribute_model')->getAttributeId() : 0; ?>
|
||||
<?php $attributeId = (!$block->isCategoryFilter($filter) && !$block->isRatingFilter($filter)) ? $filterAttributeId : 0; ?>
|
||||
<?php $categoryVisibility = $this->getCategoryVisibility($attributeId)?>
|
||||
<?php if ($filter->getItemsCount() && $categoryVisibility): ?>
|
||||
<?php if (!$wrapOptions): ?>
|
||||
<strong role="heading" aria-level="2" class="block-subtitle filter-subtitle"><?= /* @noEscape */
|
||||
__('Shopping Options') ?></strong>
|
||||
<div class="filter-options" id="narrow-by-list" data-role="content"
|
||||
data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": "<?php /* @noEscape */ echo $activeFilters; ?>", "multipleCollapsible": true, "animate":{ "duration" :300, "easing":"easeOutCubic"}}}'>
|
||||
<?php $wrapOptions = true; ?>
|
||||
<?php endif; ?>
|
||||
<div data-role="collapsible" class="filter-options-item">
|
||||
<?php $block->getChildBlock('renderer')->setAttributeId($filter) ?>
|
||||
<div data-role="title" class="filter-options-title">
|
||||
<?= $block->escapeHtml(__($filter->getName())) ?>
|
||||
<?php if ($isMultiSelectOptionDisplayEnabled && $filter->getSelectedOptionsCounter() > 0) : ?>
|
||||
<span class="ms_counter">(<?= /* @noEscape */ $filter->getSelectedOptionsCounter() ?>)</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div id="attr_<?php /* @noEscape */ echo $attributeId ?>" data-role="content"
|
||||
class="filter-options-content">
|
||||
<?php if ($horizontalSbDesignVersion === 'v3'):?>
|
||||
<div class="filter-options-content-title"> <?= $block->escapeHtml(__($filter->getName())) ?></div>
|
||||
<?php endif;?>
|
||||
<?= /* @noEscape */ $block->getChildBlock('renderer')->render($filter) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($wrapOptions): ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<script>
|
||||
require([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
$('#layered-filter-block').addClass('filter-no-options');
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="wp-ln-overlay"></div>
|
||||
<div class="wp-ln-slider-js" data-mage-init='<?= /* @noEscape */ $block->getWidgetOptionsJson() ?>'>
|
||||
<script>
|
||||
require(['jquery', 'jquery-ui-modules/effect-slide'], function($) {
|
||||
|
||||
if ($('body').hasClass('slider-layer')) {
|
||||
$('body.slider-layer #layered-filter-block').addClass('slide-in-filter');
|
||||
}
|
||||
|
||||
if ($('body').hasClass('slider-down-layer') && $(window).width() >= <?php /* @noEscape */ echo $mobileBreakpoint ?>) {
|
||||
var noOfColumns = '<?= $block->escapeJs($block->noOfColumns()) ?>',
|
||||
boxHeight = '<?= $block->escapeJs($block->boxHeight()) ?>',
|
||||
filterHeight = '<?= $block->escapeJs($block->filterColumnHeight()) ?>',
|
||||
productWrapperMarginTop = (parseInt(boxHeight.substring(0, boxHeight.length - 2)) + 50) + 'px';
|
||||
$('body.slider-down-layer #layered-filter-block').addClass('slide-down-filter');
|
||||
$('body.slider-down-layer .slide-down-filter').css({'height':boxHeight});
|
||||
$('body.slider-down-layer .slide-down-filter .filter-options-item').css({'width':noOfColumns, 'height':filterHeight});
|
||||
}
|
||||
|
||||
|
||||
if($('.slide-in-filter').length) {
|
||||
$('.wp-ln-overlay').click(pageReset);
|
||||
$('.wp-filters').click(pageSettings);
|
||||
|
||||
|
||||
function pageSettings() {
|
||||
$('.block-search, a.logo').css({'z-index': '5'});
|
||||
$('body').addClass('wp-ln-open').css({'height': '100%', 'overflow': 'hidden'});
|
||||
$('nav.navigation').css({'z-index': '1'});
|
||||
$('div.columns').css({'z-index': '6'});
|
||||
$('.wp-ln-overlay').fadeIn(100, 'linear', function () {
|
||||
$('.slide-in-filter').delay(350).show("slide", {direction: "left"});
|
||||
});
|
||||
}
|
||||
|
||||
function pageReset() {
|
||||
$('.slide-in-filter').hide('slide', {direction: "left"}, 500, function () {
|
||||
$('body').removeClass('wp-ln-open').css({'height': 'auto', 'overflow': 'auto'});
|
||||
$('.wp-ln-overlay').hide();
|
||||
$('div.page-header').css({'z-index': ''});
|
||||
$('div.columns').css({'z-index': '1'});
|
||||
/** $('nav.navigation').css({'z-index': '3'}); */
|
||||
$('.block-search, a.logo').css({'z-index': '5'});
|
||||
$('.page-wrapper .nav-sections:not(.sticky-header-nav)').removeAttr('style');
|
||||
});
|
||||
}
|
||||
} else if($('.slide-down-filter').length) {
|
||||
|
||||
$('.wp-filters').on('click', lnSlideDown);
|
||||
|
||||
|
||||
function lnSlideDown() {
|
||||
$('.wp-filters').off('click');
|
||||
$('body').attr('data-pwmt', productWrapperMarginTop);
|
||||
|
||||
$('.products.wrapper').animate({marginTop: productWrapperMarginTop},
|
||||
{
|
||||
duration:500,
|
||||
complete: function() {
|
||||
$('.wp-filters span.wp-slide-down-add').addClass('active');
|
||||
}
|
||||
|
||||
});
|
||||
$('.wp-slide-down-add:not(active)').off('click');
|
||||
$('.slide-down-filter').slideDown(500, function() {
|
||||
$('.wp-filters').on('click', lnSlideUp);
|
||||
});
|
||||
}
|
||||
|
||||
function lnSlideUp() {
|
||||
$('.wp-filters').off('click');
|
||||
$('.slide-down-filter').slideUp(
|
||||
{
|
||||
duration: 500,
|
||||
start: function(){
|
||||
$('.products.wrapper').animate(
|
||||
{
|
||||
marginTop: '0px'
|
||||
},
|
||||
{
|
||||
duration:500,
|
||||
complete: function() {
|
||||
$('.wp-filters span.wp-slide-down-add').removeClass('active');
|
||||
$('.wp-filters').on('click', lnSlideDown);
|
||||
},
|
||||
queue: false
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
queue: false
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
$('body.slider-layer .toolbar-products').css({'margin-left': '0px'});
|
||||
}
|
||||
});
|
||||
|
||||
<?php if ($jsClass): ?>
|
||||
require.config({
|
||||
map: {
|
||||
'*': {
|
||||
"productListToolbarForm": "<?= /* @noEscape */ $jsClass; ?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
require(['wpFilterSelect', 'wpInstantSearch', 'wpShowMoreLess'], function(){
|
||||
wpFilterSelect.markSelected();
|
||||
wpInstantSearch.searchOptions();
|
||||
wpShowMoreLess.initMoreLess();
|
||||
});
|
||||
|
||||
<?php if ($isStickyFiltersEnabled) : ?>
|
||||
require([
|
||||
"jquery",
|
||||
"WeltPixel_LayeredNavigation/js/stickyFilters"
|
||||
], function($, stickyFilters){
|
||||
$(document).ready(function () {
|
||||
'use strict';
|
||||
let mobileThreshold = "768",
|
||||
isStickyFiltersEnabled = "<?= /* @noEscape */ $isStickyFiltersEnabled ?>";
|
||||
stickyFilters.init(mobileThreshold, isStickyFiltersEnabled);
|
||||
});
|
||||
|
||||
});
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
|
||||
</div>
|
||||
<?php if ($horizontalSbDesignVersion === 'v3') : ?>
|
||||
<style>
|
||||
body.page-layout-1column #layered-filter-block.horizontal-v3 .block-content.filter-content .filter-options .filter-options-item .filter-options-title{
|
||||
background-color: <?php /* @noEscape */ echo $filterButtonColor ?>;
|
||||
color: <?php /* @noEscape */ echo $filterTextColor ?>;
|
||||
border: <?php /* @noEscape */ echo $filtersBorder ?>;
|
||||
border-radius: <?php /* @noEscape */ echo $filtersBorderRadius ?>;
|
||||
border-radius: <?php /* @noEscape */ echo $filtersBorderRadius ?>;
|
||||
border-radius: <?php /* @noEscape */ echo $filtersBorderRadius ?>;
|
||||
border-color: <?php /* @noEscape */ echo $filtersBorderColor ?>;;
|
||||
}
|
||||
body.page-layout-1column #layered-filter-block.horizontal-v3 .block-content.filter-content .filter-options .filter-options-item .filter-options-title:after {
|
||||
color: <?php /* @noEscape */ echo $filterTextColor ?>;
|
||||
}
|
||||
body.page-layout-1column #layered-filter-block.horizontal-v3 .block-content.filter-content .filter-options .filter-options-item .filter-options-title:hover,
|
||||
body.page-layout-1column #layered-filter-block.horizontal-v3 .block-content.filter-content .filter-options .filter-options-item.active .filter-options-title,
|
||||
body.page-layout-1column #layered-filter-block.horizontal-v3 .block-content.filter-content .filter-options .filter-options-item.active .filter-options-title:after{
|
||||
background-color: <?php /* @noEscape */ echo $filterButtonHoverColor ?> ; ;
|
||||
color: <?php /* @noEscape */ echo $filterTextHoverColor ?> ;
|
||||
}
|
||||
body.page-layout-1column #layered-filter-block.horizontal-v3 .block-content.filter-content .filter-options .filter-options-item .filter-options-title:hover::after {
|
||||
color: <?php /* @noEscape */ echo $filterTextHoverColor ?>;
|
||||
}
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<script>
|
||||
window.isLayeredNavigationEnabled = '<?= /* @noEscape */ $this->isLnEnabled()?>';
|
||||
</script>
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// @codingStandardsIgnoreFile
|
||||
/** @var $block \WeltPixel\LayeredNavigation\Block\LayeredNavigation\RenderLayered */
|
||||
?>
|
||||
<?php $swatchData = $block->getSwatchData(); ?>
|
||||
<?php $isMulti = $block->getIsMultiSelect($swatchData['attribute_id']) ?>
|
||||
<div id="swatch-wrapper" class="swatch-attribute swatch-layered <?= $block->escapeHtmlAttr($swatchData['attribute_code']) ?>"
|
||||
attribute-code="<?= $block->escapeHtmlAttr($swatchData['attribute_code']) ?>"
|
||||
attribute-id="<?= $block->escapeHtmlAttr($swatchData['attribute_id']) ?>">
|
||||
<div class="swatch-attribute-options clearfix" data-is-multi="<?= /* @noEscape */ (int)$block->getIsMultiSelect($swatchData['attribute_id']) ?>">
|
||||
<?php foreach ($swatchData['options'] as $option => $label): ?>
|
||||
<a href="<?= $block->escapeUrl($label['link']) ?>"
|
||||
aria-label="<?= $block->escapeHtmlAttr($label['label']) ?>"
|
||||
class="swatch-option-link-layered"
|
||||
data-is-multi="<?= /* @noEscape */ (int) $isMulti ?>"
|
||||
data-opt-path="<?= $block->escapeHtmlAttr($swatchData['attribute_code'] . '=' . $option) ?>"
|
||||
id="wp_ln_swatch_attr_<?= $block->escapeHtmlAttr($swatchData['attribute_id']) ?>_<?= $block->escapeHtmlAttr($option) ?>">
|
||||
<?php if (isset($swatchData['swatches'][$option]['type'])) { ?>
|
||||
<?php switch ($swatchData['swatches'][$option]['type']) {
|
||||
case '3':
|
||||
?>
|
||||
<div class="swatch-option <?= $block->escapeHtmlAttr($label['custom_style']) ?>"
|
||||
tabindex="-1"
|
||||
data-option-type="3"
|
||||
data-option-id="<?= /* @noEscape */ $option ?>"
|
||||
data-option-label="<?= /* @noEscape */ $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 <?= $block->escapeHtmlAttr($label['custom_style']) ?>"
|
||||
tabindex="-1"
|
||||
data-option-type="2"
|
||||
data-option-id="<?= /* @noEscape */ $option ?>"
|
||||
data-option-label="<?= /* @noEscape */ $label['label'] ?>"
|
||||
data-option-tooltip-thumb="<?= /* @noEscape */ $swatchThumbPath ?>"
|
||||
data-option-tooltip-value=""
|
||||
style="background: url(<?= $block->escapeUrl($swatchImagePath) ?>) no-repeat center; background-size: initial;"></div>
|
||||
<?php break;
|
||||
case '1':
|
||||
?>
|
||||
<div class="swatch-option color <?= $block->escapeHtmlAttr($label['custom_style']) ?>"
|
||||
tabindex="-1"
|
||||
data-option-type="1"
|
||||
data-option-id="<?= /* @noEscape */ $option ?>"
|
||||
data-option-label="<?= /* @noEscape */ $label['label'] ?>"
|
||||
data-option-tooltip-thumb=""
|
||||
data-option-tooltip-value="<?= /* @noEscape */ $swatchData['swatches'][$option]['value'] ?>"
|
||||
style="background: <?= /* @noEscape */ $swatchData['swatches'][$option]['value'] ?> no-repeat center; background-size: initial;"></div>
|
||||
<?php break;
|
||||
case '0':
|
||||
default:
|
||||
?>
|
||||
<div class="swatch-option text <?= $block->escapeHtmlAttr($label['custom_style']) ?>"
|
||||
tabindex="-1"
|
||||
option-type="0"
|
||||
data-option-id="<?= /* @noEscape */ $option ?>"
|
||||
data-option-label="<?= /* @noEscape */ $label['label'] ?>"
|
||||
data-option-tooltip-thumb=""
|
||||
data-option-tooltip-value=""
|
||||
><?= /* @noEscape */ $swatchData['swatches'][$option]['value'] ?></div>
|
||||
<?php break;
|
||||
} ?>
|
||||
<?php } ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
require(["jquery", "Magento_Swatches/js/swatch-renderer"], function ($) {
|
||||
$('.swatch-layered.<?= $block->escapeJs($swatchData['attribute_code']) ?>')
|
||||
.find('[data-option-type="1"], [data-option-type="2"], [data-option-type="0"], [data-option-type="3"]')
|
||||
.SwatchRendererTooltip();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
<div id="layer-product-list">
|
||||
<?php echo $block->getChildHtml() ?>
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<div id="layer-product-list">
|
||||
<?php echo $block->getChildHtml() ?>
|
||||
</div>
|
||||
Executable
+132
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/** @var \WeltPixel\LayeredNavigation\Helper\Data $wpHelper */
|
||||
$wpHelper = $this->helper('\WeltPixel\LayeredNavigation\Helper\Data');
|
||||
?>
|
||||
<?php if (($wpHelper->getSidebarStyle() == 0) && $wpHelper->isShowHideDesktopFilterEnabled()) : ?>
|
||||
<div class="show-hide-filter-desktop">
|
||||
<div class="desktop-show-filter">
|
||||
<span class="show-filter-icon"></span>
|
||||
<?= $block->escapeHtml(__('Show Filters')) ?>
|
||||
</div>
|
||||
<div class="desktop-hide-filter active">
|
||||
<span class="show-filter-icon"></span>
|
||||
<?= $block->escapeHtml(__('Hide Filters')) ?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require([
|
||||
'jquery','mage/cookies'
|
||||
], function ($) {
|
||||
var colMainWidth = null, sidebarHideDurationDefault = 500;
|
||||
var desktopHideFilterElm = $('.desktop-hide-filter'),
|
||||
desktopShowFilterElm = $('.desktop-show-filter'),
|
||||
defaultShowHideState = '<?= /* @noEscape */ $wpHelper->getShowHideDesktopFilterState() ?>';
|
||||
|
||||
function desktopHideFilter(element, hideQuickly) {
|
||||
if (!$(element).hasClass('active')) {
|
||||
return false;
|
||||
}
|
||||
let sidebarHideDuration = sidebarHideDurationDefault;
|
||||
if (hideQuickly) {
|
||||
sidebarHideDuration = 0;
|
||||
} else {
|
||||
$.cookie('wp_ln_showhide', 'hide');
|
||||
}
|
||||
$(element).hide().removeClass('active');
|
||||
$('.desktop-show-filter').css('display', 'inline-block');
|
||||
if (!colMainWidth) {
|
||||
var width = $('.column.main').outerWidth();
|
||||
var parentWidth = $('.column.main').offsetParent().width();
|
||||
colMainWidth = (100*width/parentWidth - 0.1) + "%";
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('.sidebar').animate(
|
||||
{
|
||||
'opacity': '0',
|
||||
'margin-left': '-300px'
|
||||
},
|
||||
{
|
||||
duration: sidebarHideDuration,
|
||||
queue: false,
|
||||
complete: function() {
|
||||
$(this).hide();
|
||||
}
|
||||
}
|
||||
);
|
||||
$('.column.main').addClass('no-left-padding').animate(
|
||||
{
|
||||
'width': '100%'
|
||||
},
|
||||
{
|
||||
duration: 500,
|
||||
queue: false,
|
||||
complete: function() {
|
||||
if (window.CategoryPage) {
|
||||
window.CategoryPage.buttonQuickView();
|
||||
window.CategoryPage.itemHeight(true);
|
||||
}
|
||||
$('.desktop-show-filter').addClass('active');
|
||||
}
|
||||
}
|
||||
);
|
||||
$('.toolbar.toolbar-products').addClass('auto-width').animate( {'padding-left' : '0'}, {duration: 500});
|
||||
});
|
||||
}
|
||||
function desktopShowFilter(element) {
|
||||
if (!$(element).hasClass('active')) {
|
||||
return false;
|
||||
}
|
||||
$(element).hide().removeClass('active');
|
||||
$('.desktop-hide-filter').css('display', 'inline-block');
|
||||
$.cookie('wp_ln_showhide', 'show');
|
||||
|
||||
$(function() {
|
||||
$('.sidebar').show().css('opacity', '1').animate(
|
||||
{
|
||||
'margin-left': '0'
|
||||
},
|
||||
{
|
||||
duration: 500,
|
||||
queue: false,
|
||||
complete: function() {
|
||||
$('.desktop-hide-filter').addClass('active');
|
||||
}
|
||||
}
|
||||
);
|
||||
$('.column.main').removeClass('no-left-padding').animate(
|
||||
{
|
||||
'width': colMainWidth
|
||||
},
|
||||
{
|
||||
duration: 500,
|
||||
queue: false,
|
||||
complete: function() {
|
||||
if (window.CategoryPage) {
|
||||
window.CategoryPage.buttonQuickView();
|
||||
window.CategoryPage.itemHeight(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
$('.toolbar.toolbar-products').removeClass('auto-width').animate( {'padding-left' : '12px'}, {duration: 500});
|
||||
}
|
||||
|
||||
desktopHideFilterElm.bind('click', function () {
|
||||
desktopHideFilter(this, false);
|
||||
});
|
||||
desktopShowFilterElm.bind('click', function () {
|
||||
desktopShowFilter(this);
|
||||
});
|
||||
|
||||
$('.sidebar').addClass('desktop-showhide-filter-on')
|
||||
|
||||
if ($.cookie('wp_ln_showhide') == 'hide') {
|
||||
desktopHideFilter(desktopHideFilterElm, true);
|
||||
} else if ($.cookie('wp_ln_showhide') != 'show' && defaultShowHideState == 'closed') {
|
||||
desktopHideFilter(desktopHideFilterElm, true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user