Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WZ-3524: Added functionality to display facets in drawer. #148

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Block/BaseBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ public function getConfigs()
'sessions' => '/wtrack/analytics/session',
],
],
'filters' => [
'configs' => [
'displayAsDrawer' => ($this->storeSearchConfig->leftFacetsHasToDisplayAsDrawer() == '1') ? true : false,
],
],
];

return $configs;
Expand Down
9 changes: 9 additions & 0 deletions Services/Store/StoreSearchConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class StoreSearchConfig

const WIZZY_SEARCH_FACETS_CONFIGURATION = self::WIZZY_SEARCH_CONFIGURATION . "/search_results_facets_configuration";
const WIZZY_FACETS = self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/facets_configuration";
const WIZZY_FACETS_DISPLAY_AS_DRAWER =
self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/left_facets_has_to_display_in_drawer";
const WIZZY_FACET_CATEGORY_DISPLAY = self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/category_facet_display_method";
const WIZZY_LEFT_FACETS_COLLAPSIBLE = self::WIZZY_SEARCH_FACETS_CONFIGURATION . "/left_facets_has_to_collapsible";
const WIZZY_LEFT_FACETS_DEFAULT_COLLAPSIBLE_BEHAVIOUR =
Expand Down Expand Up @@ -101,6 +103,13 @@ public function getFacetsConfiguration()

return json_decode($facetsConfig, true);
}
public function leftFacetsHasToDisplayAsDrawer()
{
return $this->configManager->getStoreConfig(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly return true / false from here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pending.

self::WIZZY_FACETS_DISPLAY_AS_DRAWER,
$this->storeId
);
}

public function getCategoryDisplayMethod()
{
Expand Down
11 changes: 11 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,17 @@
</comment>
</field>

<field id="left_facets_has_to_display_in_drawer" translate="label" type="select" sortOrder="2" showInDefault="0" showInWebsite="0" showInStore="1">
<label>Display Inside Drawer?</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>
<![CDATA[
Choose Yes if you would like to display facets under drawer.
]]>
</comment>
<validate>required-entry</validate>
</field>

<field id="category_facet_display_method" translate="label" type="select" sortOrder="2" showInDefault="0" showInWebsite="0" showInStore="1">
<label>Categories Rendering Method</label>
<source_model>Wizzy\Search\Model\Admin\Source\CategoriesRenderSelection</source_model>
Expand Down
15 changes: 13 additions & 2 deletions view/frontend/templates/search/wrapper.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ $addMoveToTopWidget = $configs['search']['configs']['pagination']['moveToTopWidg
<div class="wizzy-search-wrapper {{#inOnCategoryPage}}wizzy-category-page{{/inOnCategoryPage}}
{{#hasFacets}}has-facets{{/hasFacets}}
{{#hasLeftFacets}}has-left-facets{{/hasLeftFacets}}
{{#hasTopFacets}}has-top-facets{{/hasTopFacets}}">
{{#hasTopFacets}}has-top-facets{{/hasTopFacets}}
{{#displayFacetsInDrawer}}has-facets-in-drawer facets-drawer-on-{{facetDrawerPosition}}
{{/displayFacetsInDrawer}}">

<div class="wizzy-search-summary-wrapper">
{{#summary}}
Expand Down Expand Up @@ -47,7 +49,16 @@ $addMoveToTopWidget = $configs['search']['configs']['pagination']['moveToTopWidg
<div class="wizzy-search-results-container">

<div class="wizzy-search-filters-top">

{{#displayFacetsInDrawer}}
<div class="wizzy-search-filters-drawer">
<div class="wizzy-search-filters-drawer-button">
<a href="#" class="wizzy-filters-desktop-entry">
<span class="wizzy-filters-button"></span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may also need to update the frontend min CSS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pending.

<span>Filters</span>
</a>
</div>
</div>
{{/displayFacetsInDrawer}}
<div class="search-filters-top-wrapper">
<div class="wizzy-search-filters-list-top">
{{#topFacets}}
Expand Down
Loading