Ich würde das Thema auch gerne nochmal aufgreifen. Bei mir funktioniert es noch nicht bzw. es werden keine Inhalte geladen.
@area-net-gmbh Ich habe versucht Deiner Anweisung zu folgen.
Schritt 1: Ich habe die @Storefront/storefront/element/cms-element-sidebar-filter.html.twig wie von Dir beschrieben angepasst. Somit ist die Sortierung in der selben Zeile wie der Filter sichtbar:
Schritt 2: Ich habe ein eigenes Plugin (CustomFilterSort
) erstellt, um das $ListingSorting$
-Plugin zu überschreiben und die $afterContentChange()$
-Methode anzupassen.
\custom\plugins\CustomFilterSort\src\Resources\app\storefront\src\an-listing-sorting.plugin.js
import ListingSortingPlugin from 'src/plugin/listing/listing-sorting.plugin';
export default class AnListingSortingPlugin extends ListingSortingPlugin {
afterContentChange() {
if (!this.options.showInFilter) {
this.listing.deregisterFilter(this);
}
super.afterContentChange();
}
}
\custom\plugins\CustomFilterSort\src\Resources\app\storefront\src\main.js
import AnListingSortingPlugin from './an-listing-sorting.plugin';
const PluginManager = window.PluginManager;
if (PluginManager) {
PluginManager.override('ListingSorting', AnListingSortingPlugin);
}
\custom\plugins\CustomFilterSort\src\CustomFilterSort.php
<?php declare(strict_types=1);
namespace CustomFilterSort;
use Shopware\Core\Framework\Plugin;
class CustomFilterSort extends Plugin
{
}
\custom\plugins\CustomFilterSort\compiser.json
{
"name": "custom/custom-filter-sort",
"description": "Custom plugin for filter and sort adjustments.",
"type": "shopware-platform-plugin",
"autoload": {
"psr-4": {
"CustomFilterSort\\": "src/"
}
},
"extra": {
"shopware-plugin-class": "CustomFilterSort\\CustomFilterSort",
"label": {
"en-GB": "Custom Filter Sort",
"de-DE": "Eigene Filter-Sortierung"
}
}
}
Wäre für jede Hilfe sehr dankbar!