Skip to content

Commit 87b022e

Browse files
a.laurowskiAleksander Laurowski
authored andcommitted
FFWEB-2125: Hide category filter on category page
1 parent 9d557f9 commit 87b022e

6 files changed

Lines changed: 51 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
composer.lock
22
/vendor
3+
.idea

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Changelog
2-
## [Unreleased]
2+
## UNRELEASED
33
### Add
44
- Export
55
- Added new field provider `Omikron\FactFinder\Shopware6\Export\Field\Layout` applicable to CMS Export
66

7+
### Change
8+
- Category
9+
- hide `<ff-asn-group>` responsible for rendering category filters as this breaks the Web Components navigation mode.
10+
User should navigate between categories using shop main navigation
11+
712
## [v3.0.1] - 2022.03.10
813
### Fix
914
- `Omikron\FactFinder\Shopware6\Subscriber\CategoryView`
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{% block component_factfinder_asn_group_single %}
2+
{{ groupName }}
3+
<ff-asn-group for-group="{{ groupName}}" class="filter-panel-item dropdown {% if vertical %} ffw-asn-group-vertical btn-block {% endif %} {{ cssClass }}"
4+
disable-auto-expand>
5+
<div slot="groupCaption" class="filter-panel-item-toggle btn {% if vertical %} btn-block {% endif %}">
6+
{{ '{{group.name}}' }}
7+
{% sw_icon 'arrow-medium-down' style { 'pack': 'solid', 'size': 'xs', 'class': 'filter-panel-item-toggle' } %}
8+
</div>
9+
<ff-asn-group-element class="filter-multi-select-list-item" {% if vertical %}
10+
ffw-asn-group-element-vertical {% endif %}">
11+
<div slot="selected" class="custom-control custom-checkbox">
12+
<input type="checkbox" class="custom-control-input filter-multi-select-checkbox" checked/>
13+
<span class="filter-multi-select-item-label custom-control-label">{{ '{{element.name}}' }}</span>
14+
</div>
15+
<div slot="unselected" class="custom-control custom-checkbox">
16+
<input type="checkbox" class="custom-control-input filter-multi-select-checkbox"/>
17+
<span class="filter-multi-select-item-label custom-control-label">{{ '{{element.name}}' }}</span>
18+
</div>
19+
</ff-asn-group-element>
20+
</ff-asn-group>
21+
{% endblock %}

src/Resources/views/storefront/components/factfinder/asn.html.twig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
unresolved
1717
subscribe="{{ subscribe ? 'true' : 'false' }}"
1818
topic="{{ topic|default('asn') }}">
19+
20+
{% block component_factfinder_asn_group_custom %}
21+
{% for group in customGroups %}
22+
{% sw_include group.template ignore missing with {
23+
cssClass: group.cssClass,
24+
groupName: group.groupName
25+
} %}
26+
{% endfor %}
27+
{% endblock %}
28+
1929
{% block component_factfinder_asn_group %}
2030
<ff-asn-group class="filter-panel-item dropdown {% if vertical %} ffw-asn-group-vertical btn-block {% endif %}"
2131
disable-auto-expand>

src/Resources/views/storefront/element/cms-element-asn.html.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
{% set config = element.config %}
33
{% set id = config.id.value|default(element.id) %}
44
{% set topic = config.topic.value|default('asn') %}
5-
65
{% sw_include '@Parent/storefront/components/factfinder/asn.html.twig' with {
76
vertical: config.vertical.value,
87
subscribe: config.subscribe.value,
8+
customGroups: [
9+
{
10+
groupName : page.extensions.factfinder.categoryPathFieldName,
11+
cssClass: 'd-none',
12+
template: '@Parent/storefront/components/factfinder/asn-group.html.twig'
13+
}
14+
],
915
filterCloud: config.filterCloud.value,
1016
filterCloudBlacklist: config.filterCloudBlacklist.value,
1117
filterCloudWhitelist: config.filterCloudWhitelist.value,

src/Subscriber/CategoryPageSubscriber.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ public function onPageLoaded(NavigationPageLoadedEvent $event): void
6363
'add-params' => implode(',', array_map(fn (string $key, string $value): string => sprintf('%s=%s', $key, $value), array_keys($mergedAddParams), array_values($mergedAddParams))),
6464
] + ($searchImmediate ? ['category-page' => $this->prepareCategoryPath($category)] : []);
6565

66-
$event->getPage()->getExtension('factfinder')->assign(['communication' => $communication]);
66+
$event->getPage()->getExtension('factfinder')->assign(
67+
[
68+
'communication' => $communication,
69+
'categoryPathFieldName' => "{$this->fieldName}ROOT",
70+
]
71+
);
6772
}
6873

6974
private function prepareCategoryPath(CategoryEntity $categoryEntity): string

0 commit comments

Comments
 (0)