view.phtml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Mageplaza
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Mageplaza.com license that is
  8. * available through the world-wide-web at this URL:
  9. * https://www.mageplaza.com/LICENSE.txt
  10. *
  11. * DISCLAIMER
  12. *
  13. * Do not edit or add to this file if you wish to upgrade this extension to newer
  14. * version in the future.
  15. *
  16. * @category Mageplaza
  17. * @package Mageplaza_LayeredNavigation
  18. * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
  19. * @license https://www.mageplaza.com/LICENSE.txt
  20. */
  21. ?>
  22. <?php if ($block->canShowBlock()): ?>
  23. <?php
  24. $filters = $block->getFilters();
  25. $layerConfig = $this->helper('Mageplaza\LayeredNavigation\Helper\Data')->getLayerConfiguration($filters);
  26. $filtered = count($block->getLayer()->getState()->getFilters());
  27. ?>
  28. <div class="block filter" id="layered-filter-block"
  29. data-mage-init='{"collapsible":{"openedState": "active", "collapsible": true, "active": false, "collateral": { "openedState": "filter-active", "element": "body" } }}'>
  30. <div id="ln_overlay" class="ln_overlay">
  31. <div class="loader">
  32. <img src="<?php echo $block->getViewFileUrl('images/loader-1.gif'); ?>" alt="Loading...">
  33. </div>
  34. </div>
  35. <div class="block-title filter-title" data-count="<?php /* @escapeNotVerified */
  36. echo $filtered; ?>">
  37. <strong data-role="title"><?php /* @escapeNotVerified */
  38. echo __('Shop By') ?></strong>
  39. </div>
  40. <div class="block-content filter-content" data-mage-init='{"mpLayer": <?php echo $layerConfig ?>}'>
  41. <?php echo $block->getChildHtml('state') ?>
  42. <?php if ($block->getLayer()->getState()->getFilters()): ?>
  43. <div class="block-actions filter-actions">
  44. <a href="<?php /* @escapeNotVerified */
  45. echo $block->getClearUrl() ?>"
  46. class="action clear filter-clear"><span><?php /* @escapeNotVerified */
  47. echo __('Clear All') ?></span></a>
  48. </div>
  49. <?php endif; ?>
  50. <?php $wrapOptions = false; ?>
  51. <?php foreach ($filters
  52. as $key => $filter): ?>
  53. <?php if ($filter->getItemsCount()): ?>
  54. <?php if (!$wrapOptions): ?>
  55. <strong role="heading" aria-level="2"
  56. class="block-subtitle filter-subtitle"><?php echo __('Shopping Options') ?></strong>
  57. <div class="filter-options" id="narrow-by-list" data-role="content">
  58. <?php $wrapOptions = true;
  59. endif; ?>
  60. <div data-role="ln_collapsible" class="filter-options-item"
  61. attribute="<?php echo $filter->getRequestVar() ?>">
  62. <div data-role="ln_title" class="filter-options-title"><?php /* @escapeNotVerified */
  63. echo __($filter->getName()) ?></div>
  64. <div data-role="ln_content" class="filter-options-content"><?php /* @escapeNotVerified */
  65. echo $block->getChildBlock('renderer')->setFilter($filter)->render($filter); ?></div>
  66. </div>
  67. <?php endif; ?>
  68. <?php endforeach; ?>
  69. <?php if ($wrapOptions): ?>
  70. </div>
  71. <?php else: ?>
  72. <script>
  73. require([
  74. 'jquery'
  75. ], function ($) {
  76. $('#layered-filter-block').addClass('filter-no-options');
  77. });
  78. </script>
  79. <?php endif; ?>
  80. <?php echo $block->getChildHtml('layer_additional_info') ?>
  81. </div>
  82. </div>
  83. <?php endif; ?>