init
This commit is contained in:
+105
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
// @codingStandardsIgnoreFile
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Category layered navigation
|
||||
*
|
||||
* @var $block WeltPixel\LayeredNavigation\Block\Navigation
|
||||
*/
|
||||
|
||||
$isAjaxMode = $block->isAjaxMode();
|
||||
$jsClass = ($isAjaxMode) ? 'WeltPixel_LayeredNavigation/js/product/list/toolbar' : false;
|
||||
?>
|
||||
<?php if ($block->canShowBlock()): ?>
|
||||
<div class="wp-filters <?php if ($isAjaxMode) echo 'wp-filters-ajax' ?>">
|
||||
<?= /* @escapeNotVerified */
|
||||
$block->getFilterButtonHtml() ?>
|
||||
</div>
|
||||
<div class="block filter" id="layered-filter-block"
|
||||
data-mage-init='{"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="<?= /* @escapeNotVerified */
|
||||
$filtered ?>">
|
||||
<strong data-role="title"><?= /* @escapeNotVerified */
|
||||
__('筛选结果') ?></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 $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)) ? $filterAttributeId : 0; ?>
|
||||
<?php if ($filter->getItemsCount()): ?>
|
||||
<?php if (!$wrapOptions): ?>
|
||||
|
||||
<div class="filter-options" id="narrow-by-list" data-role="content"
|
||||
data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": "<?php echo $activeFilters; ?>", "multipleCollapsible": true}}'>
|
||||
<?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">
|
||||
<?= /* @escapeNotVerified */ __($filter->getName()) ?></div>
|
||||
<div id="attr_<?php echo $attributeId ?>" data-role="content"
|
||||
class="filter-options-content"><?= /* @escapeNotVerified */
|
||||
$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='<?= /* @escapeNotVerified */ $block->getWidgetOptionsJson() ?>'>
|
||||
<script>
|
||||
<?php if ($jsClass): ?>
|
||||
require.config({
|
||||
map: {
|
||||
'*': {
|
||||
"productListToolbarForm": "<?= $jsClass?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
require(['wpFilterSelect'], function(){
|
||||
wpFilterSelect.markSelected();
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
<?php $redirectUrl = $block->getRedirectUrl(); ?>
|
||||
<?php if ($redirectUrl): ?>
|
||||
<script>
|
||||
window.location.href = '<?= $redirectUrl ?>';
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user