Skip to content

Commit 3f1c002

Browse files
committed
WZ-3524: Added functionality to display facets in drawer
1 parent 43b16f3 commit 3f1c002

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

Block/BaseBlock.php

+5
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ public function getConfigs()
311311
'sessions' => '/wtrack/analytics/session',
312312
],
313313
],
314+
'filters' => [
315+
'configs' => [
316+
'displayAsDrawer' => ($this->storeSearchConfig->leftFacetsHasToDisplayAsDrawer() == '1') ? true : false,
317+
],
318+
],
314319
];
315320

316321
return $configs;

Services/Store/StoreSearchConfig.php

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class StoreSearchConfig
2121

2222
const WIZZY_SEARCH_FACETS_CONFIGURATION = self::WIZZY_SEARCH_CONFIGURATION . "/search_results_facets_configuration";
2323
const WIZZY_FACETS = self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/facets_configuration";
24+
const WIZZY_FACETS_DISPLAY_AS_DRAWER = self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/left_facets_has_to_display_in_drawer";
2425
const WIZZY_FACET_CATEGORY_DISPLAY = self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/category_facet_display_method";
2526
const WIZZY_LEFT_FACETS_COLLAPSIBLE = self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/left_facets_has_to_collapsible";
2627
const WIZZY_LEFT_FACETS_DEFAULT_COLLAPSIBLE_BEHAVIOUR =
@@ -102,6 +103,12 @@ public function getFacetsConfiguration()
102103
return json_decode($facetsConfig, true);
103104
}
104105

106+
public function leftFacetsHasToDisplayAsDrawer()
107+
{
108+
return $this->configManager->getStoreConfig(self::WIZZY_FACETS_DISPLAY_AS_DRAWER, $this->storeId);
109+
}
110+
111+
105112
public function getCategoryDisplayMethod()
106113
{
107114
return $this->configManager->getStoreConfig(self::WIZZY_FACET_CATEGORY_DISPLAY, $this->storeId);

etc/adminhtml/system.xml

+11
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,17 @@
580580
</comment>
581581
</field>
582582

583+
<field id="left_facets_has_to_display_in_drawer" translate="label" type="select" sortOrder="2" showInDefault="0" showInWebsite="0" showInStore="1">
584+
<label>Display Inside Drawer?</label>
585+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
586+
<comment>
587+
<![CDATA[
588+
Choose Yes if you would like to display facets under drawer.
589+
]]>
590+
</comment>
591+
<validate>required-entry</validate>
592+
</field>
593+
583594
<field id="category_facet_display_method" translate="label" type="select" sortOrder="2" showInDefault="0" showInWebsite="0" showInStore="1">
584595
<label>Categories Rendering Method</label>
585596
<source_model>Wizzy\Search\Model\Admin\Source\CategoriesRenderSelection</source_model>

view/frontend/templates/search/wrapper.phtml

+12-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ $addMoveToTopWidget = $configs['search']['configs']['pagination']['moveToTopWidg
77
<div class="wizzy-search-wrapper {{#inOnCategoryPage}}wizzy-category-page{{/inOnCategoryPage}}
88
{{#hasFacets}}has-facets{{/hasFacets}}
99
{{#hasLeftFacets}}has-left-facets{{/hasLeftFacets}}
10-
{{#hasTopFacets}}has-top-facets{{/hasTopFacets}}">
10+
{{#hasTopFacets}}has-top-facets{{/hasTopFacets}}
11+
{{#displayFacetsInDrawer}}has-facets-in-drawer facets-drawer-on-{{facetDrawerPosition}}{{/displayFacetsInDrawer}}">
1112

1213
<div class="wizzy-search-summary-wrapper">
1314
{{#summary}}
@@ -47,7 +48,16 @@ $addMoveToTopWidget = $configs['search']['configs']['pagination']['moveToTopWidg
4748
<div class="wizzy-search-results-container">
4849

4950
<div class="wizzy-search-filters-top">
50-
51+
{{#displayFacetsInDrawer}}
52+
<div class="wizzy-search-filters-drawer">
53+
<div class="wizzy-search-filters-drawer-button">
54+
<a href="#" class="wizzy-filters-desktop-entry">
55+
<span class="wizzy-filters-button"></span>
56+
<span>Filters</span>
57+
</a>
58+
</div>
59+
</div>
60+
{{/displayFacetsInDrawer}}
5161
<div class="search-filters-top-wrapper">
5262
<div class="wizzy-search-filters-list-top">
5363
{{#topFacets}}

0 commit comments

Comments
 (0)