custom/plugins/fourtwosixAttributeBadges/src/Subscriber/ListingSubscriber.php line 17

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace fourtwosix\AttributeBadges\Subscriber;
  3. use Shopware\Core\Content\Product\Events\ProductListingCriteriaEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class ListingSubscriber implements EventSubscriberInterface
  6. {
  7.     public static function getSubscribedEvents(): array
  8.     {
  9.         return [
  10.             ProductListingCriteriaEvent::class => 'onListing'
  11.         ];
  12.     }
  13.     public function onListing(ProductListingCriteriaEvent $event)
  14.     {
  15.         $criteria $event->getCriteria();
  16.         $criteria->addAssociation('properties');
  17.         $criteria->addAssociation('properties.group');
  18.     }
  19. }