custom/plugins/ATNTheme/src/Subscriber/ListingSubscriber.php line 19

Open in your IDE?
  1. <?php
  2. namespace ATNTheme\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()
  8.     {
  9.         return [
  10.             ProductListingCriteriaEvent::class => 'modifyListingCriteria',
  11.         ];
  12.     }
  13.     public function modifyListingCriteria(ProductListingCriteriaEvent $event)
  14.     {
  15.         $event->getCriteria()->addAssociation('properties');
  16.         $event->getCriteria()->addAssociation('properties.group');
  17.     }
  18. }