Skip to content

Commit 2742767

Browse files
authored
FFWEB-3227: Add the ability to set a name for the CategoryPath field
Add the ability to set a name for the CategoryPath field (category page)
1 parent ad59ca6 commit 2742767

File tree

5 files changed

+48
-29
lines changed

5 files changed

+48
-29
lines changed

.php-cs-fixer.dist.php

+27-27
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,31 @@
1919
->setHideProgress(true)
2020
->setUsingCache(false)
2121
->setRules([
22-
'@PSR2' => true,
23-
'@PSR12' => true,
24-
'@PHP74Migration:risky' => true,
25-
'@Symfony' => true,
26-
'array_syntax' => ['syntax' => 'short'],
27-
'binary_operator_spaces' => [
28-
'operators' => [
29-
'=' => 'align',
30-
'=>' => 'align',
31-
],
32-
],
33-
'blank_line_after_opening_tag' => true,
34-
'line_ending' => true,
35-
'class_attributes_separation' => false,
36-
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'throw', 'try']],
37-
'concat_space' => ['spacing' => 'one'],
38-
'declare_strict_types' => true,
39-
'increment_style' => ['style' => 'post'],
40-
'no_superfluous_phpdoc_tags' => false,
41-
'no_useless_else' => true,
42-
'no_useless_return' => true,
43-
'ordered_class_elements' => true,
44-
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
45-
'strict_comparison' => true,
46-
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
47-
'nullable_type_declaration_for_default_null_value' => false,
48-
])
22+
'@PSR2' => true,
23+
'@PSR12' => true,
24+
'@PHP74Migration:risky' => true,
25+
'@Symfony' => true,
26+
'array_syntax' => ['syntax' => 'short'],
27+
'binary_operator_spaces' => [
28+
'operators' => [
29+
'=' => 'align',
30+
'=>' => 'align',
31+
],
32+
],
33+
'blank_line_after_opening_tag' => true,
34+
'line_ending' => true,
35+
'class_attributes_separation' => false,
36+
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'throw', 'try']],
37+
'concat_space' => ['spacing' => 'one'],
38+
'declare_strict_types' => true,
39+
'increment_style' => ['style' => 'post'],
40+
'no_superfluous_phpdoc_tags' => false,
41+
'no_useless_else' => true,
42+
'no_useless_return' => true,
43+
'ordered_class_elements' => true,
44+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
45+
'strict_comparison' => true,
46+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
47+
'nullable_type_declaration_for_default_null_value' => false,
48+
])
4949
->setFinder($finder);

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
## Unreleased
3+
### Improve
4+
- Add the ability to set a name for the CategoryPath field (category page)
5+
26
## [v6.0.0] - 2024.07.12
37
### BREAKING
48
- IMPORTANT! Drop Shopware 6.5 compatibility

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ modifications in order to fit their needs. For more advanced features please che
2727
- [Campaigns Element](#campaigns-element)
2828
- [Blocks and Elements Templates](#blocks-and-elements-templates)
2929
- [Assigning Layout to Category](#assigning-layout-to-category)
30+
- [Set correct name for CategoryPath field](#set-correct-name-for-categorypath-field)
3031
- [Exporting Feeds](#exporting-feeds)
3132
- [CLI](#cli)
3233
- [Selecting Categories for CMS Export](#selecting-categories-for-cms-export)
@@ -276,6 +277,15 @@ Once the page layout is done, you need to assign layout to selected categories.
276277
We strongly recommend not creating many layouts as currently there's still only few possibilities offered anyway.
277278
Future development will bring more blocks and elements will be provided here.
278279

280+
### Set correct name for CategoryPath field
281+
282+
By default, SDK uses a field named CategoryPath (default field name for FactFinder instance).
283+
If in your FactFinder instance configuration you have a different field name for Category field then you must set this name in the `services.xml` file as shown below:
284+
285+
//src/Resources/config/services.xml:34
286+
<parameter key="factfinder.navigation.category_path_field_name" type="string">CategoryPath</parameter>
287+
288+
279289
## Exporting Feeds
280290

281291
FACT-Finder allows to export different types of feeds, like a **products**, **cms** and **brands** (or manufacturers)
@@ -504,6 +514,9 @@ where `$association` would be a `children.cover` in that example.
504514
**Note:**
505515
Please note that adding more and more associations will have an impact on overall export performance.
506516

517+
**Note:**
518+
If you need to export variant names in data feed you could use [this sample code as an example](https://github.com/FACT-Finder-Web-Components/shopware6-plugin/pull/258):
519+
507520
### Creating Custom Entity Export
508521

509522
Plugin offers a flexible export mechanism which could be specified to work with different types of entities.

src/Resources/config/services.xml

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
<parameter key="factfinder.export.associations" type="collection">
4848
<parameter key="variant_cover">children.media</parameter>
4949
</parameter>
50-
<parameter key="factfinder.navigation.category_path_field_name" type="string">CategoryPath</parameter>
5150
<parameter key="factfinder.category_page.add_params" type="collection">
5251
</parameter>
5352
<parameter key="factfinder.configuration.add_params" type="collection">

src/Resources/views/storefront/block/cms-block-listing.html.twig

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
document.addEventListener(`ffCoreReady`, ({ factfinder }) => {
88
factfinder.config.setAppConfig({
99
categoryPage: [
10-
factfinder.utils.filterBuilders.categoryFilter(`CategoryPath`, {{ (page.extensions.factfinder.communication.categoryPage|split(',')|json_encode())|raw }})
10+
factfinder.utils.filterBuilders.categoryFilter(
11+
'{{ page.extensions.factfinder.categoryPathFieldName|replace({'ROOT': ''}) }}',
12+
{{ (page.extensions.factfinder.communication.categoryPage|split(',')|json_encode())|raw }}
13+
)
1114
],
1215
});
1316

0 commit comments

Comments
 (0)