<?php declare(strict_types=1);
namespace fourtwosix\AttributeBadges\Subscriber;
use Shopware\Core\Content\Product\Events\ProductListingCriteriaEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ListingSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
ProductListingCriteriaEvent::class => 'onListing'
];
}
public function onListing(ProductListingCriteriaEvent $event)
{
$criteria = $event->getCriteria();
$criteria->addAssociation('properties');
$criteria->addAssociation('properties.group');
}
}