custom/plugins/SFCustom/src/Subscriber/ExtendListingSubscriber.php line 21

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