<?php
namespace LoyxxSW6SeoFaqManager\Subscribers;
use LoyxxSW6SeoFaqManager\Core\Traits\EnrichCriteriaTrait;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting;
use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepositoryInterface;
use Shopware\Storefront\Page\Product\ProductLoaderCriteriaEvent;
use Shopware\Storefront\Page\Product\ProductPageLoadedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ProductPageLoadSeoFaqEventSubscriber implements EventSubscriberInterface
{
use EnrichCriteriaTrait;
/**
* @var SalesChannelRepositoryInterface
*/
private $productRepository;
public function __construct(SalesChannelRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
}
public static function getSubscribedEvents(): array
{
return [
ProductLoaderCriteriaEvent::class => 'onProductPageLoadedEvent'
];
}
public function onProductPageLoadedEvent(ProductLoaderCriteriaEvent $event)
{
$this->enrichFaqCriteria($event->getCriteria());
}
}