Produkte in Search Suggest um Hersteller erweitern | Event gesucht

Hallo,

ich würde gerne bei den Surchvorschlägen im Fenster unter der Suchleiste die Hersteller mit ausgeben. Im Listing etc. lässt sich das ja einfach über das ProductEvents::PRODUCT_LOADED_EVENT. Wie ist der Event für die Search Suggests? ProductSuggestCriteriaEvent oder ProductSuggestResultEvent möglicherweise?

Lg Alex

Lösung für alle die es interessiert:

[YOUR_PLUGIN]\src\Core\Content\Product\Events\CustomProductSearchResultEventSubscriber.php

<?php declare(strict_types=1);

namespace [YOUR_NAMESPACE]\Core\Content\Product\Events;

use Shopware\Core\Content\Product\Events\ProductSuggestCriteriaEvent;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\Content\Product\ProductEvents;

class CustomProductSearchResultEventSubscriber implements EventSubscriberInterface 
{
    /**
     * @var EntityRepositoryInterface 
     */
    private $productManufacturerRepository;

    
    public function __construct(EntityRepositoryInterface $productManufacturerRepository) 
    {
        $this->productManufacturerRepository = $productManufacturerRepository;
    }

    public static function getSubscribedEvents()
    {
        return [
            ProductEvents::PRODUCT_SUGGEST_CRITERIA => "addManufacturerToSearchSuggestCriteria",
        ];
    }

    public function addManufacturerToSearchSuggestCriteria(ProductSuggestCriteriaEvent $event): void
    {
        if (!$event instanceof ProductSuggestCriteriaEvent)
            return;

        $criteria = $event->getCriteria();
        $criteria->addAssociation('manufacturer');
    }
}

?>

[YOUR_PLUGIN]\src\Ressources\config\services.xml

...
<service id="[YOUR_NAMESPACE]\Core\Content\Product\Events\CustomProductSearchResultEventSubscriber">
   <tag name="kernel.event_subscriber" />
   <argument type="service" id="product_manufacturer.repository" /> 
</service>
...

Lg Alex