Skip to content

Commit

Permalink
FFWEB-3227: Add the ability to set a name for the CategoryPath field
Browse files Browse the repository at this point in the history
Add the ability to set a name for the CategoryPath field (category page)
  • Loading branch information
Rayn93 committed Nov 20, 2024
1 parent ad59ca6 commit f69faad
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 29 deletions.
54 changes: 27 additions & 27 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@
->setHideProgress(true)
->setUsingCache(false)
->setRules([
'@PSR2' => true,
'@PSR12' => true,
'@PHP74Migration:risky' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'operators' => [
'=' => 'align',
'=>' => 'align',
],
],
'blank_line_after_opening_tag' => true,
'line_ending' => true,
'class_attributes_separation' => false,
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'throw', 'try']],
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'increment_style' => ['style' => 'post'],
'no_superfluous_phpdoc_tags' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
'strict_comparison' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'nullable_type_declaration_for_default_null_value' => false,
])
'@PSR2' => true,
'@PSR12' => true,
'@PHP74Migration:risky' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'operators' => [
'=' => 'align',
'=>' => 'align',
],
],
'blank_line_after_opening_tag' => true,
'line_ending' => true,
'class_attributes_separation' => false,
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'throw', 'try']],
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'increment_style' => ['style' => 'post'],
'no_superfluous_phpdoc_tags' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
'strict_comparison' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'nullable_type_declaration_for_default_null_value' => false,
])
->setFinder($finder);
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## Unreleased
### Improve
- Add the ability to set a name for the CategoryPath field (category page)

## [v6.0.0] - 2024.07.12
### BREAKING
- IMPORTANT! Drop Shopware 6.5 compatibility
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ modifications in order to fit their needs. For more advanced features please che
- [Campaigns Element](#campaigns-element)
- [Blocks and Elements Templates](#blocks-and-elements-templates)
- [Assigning Layout to Category](#assigning-layout-to-category)
- [Set correct name for CategoryPath field](#set-correct-name-for-categorypath-field)
- [Exporting Feeds](#exporting-feeds)
- [CLI](#cli)
- [Selecting Categories for CMS Export](#selecting-categories-for-cms-export)
Expand Down Expand Up @@ -276,6 +277,15 @@ Once the page layout is done, you need to assign layout to selected categories.
We strongly recommend not creating many layouts as currently there's still only few possibilities offered anyway.
Future development will bring more blocks and elements will be provided here.

### Set correct name for CategoryPath field

By default, SDK uses a field named CategoryPath (default field name for FactFinder instance).
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:

//src/Resources/config/services.xml:34
<parameter key="factfinder.navigation.category_path_field_name" type="string">CategoryPath</parameter>


## Exporting Feeds

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

**Note:**
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):

### Creating Custom Entity Export

Plugin offers a flexible export mechanism which could be specified to work with different types of entities.
Expand Down
1 change: 0 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<parameter key="factfinder.export.associations" type="collection">
<parameter key="variant_cover">children.media</parameter>
</parameter>
<parameter key="factfinder.navigation.category_path_field_name" type="string">CategoryPath</parameter>
<parameter key="factfinder.category_page.add_params" type="collection">
</parameter>
<parameter key="factfinder.configuration.add_params" type="collection">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
document.addEventListener(`ffCoreReady`, ({ factfinder }) => {
factfinder.config.setAppConfig({
categoryPage: [
factfinder.utils.filterBuilders.categoryFilter(`CategoryPath`, {{ (page.extensions.factfinder.communication.categoryPage|split(',')|json_encode())|raw }})
factfinder.utils.filterBuilders.categoryFilter(
'{{ page.extensions.factfinder.categoryPathFieldName|replace({'ROOT': ''}) }}',
{{ (page.extensions.factfinder.communication.categoryPage|split(',')|json_encode())|raw }}
)
],
});
Expand Down

0 comments on commit f69faad

Please sign in to comment.