custom/plugins/IdeaBooks/src/Storefront/Subscriber/ProductCrossSellingStreamCriteriaSubscriber.php line 22

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace IdeaBooks\Storefront\Subscriber;
  3. use Shopware\Core\Content\Product\Events\ProductCrossSellingStreamCriteriaEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Shopware\Core\Framework\Struct\ArrayEntity;
  6. use IdeaBooks\Content\Product\SalesChannel\ProductCoverFilter;
  7. class ProductCrossSellingStreamCriteriaSubscriber implements EventSubscriberInterface
  8. {
  9.     public static function getSubscribedEvents(): array
  10.     {
  11.         return [
  12.           ProductCrossSellingStreamCriteriaEvent::class => 'addCoverFilter'
  13.         ];
  14.     }
  15.      public function addCoverFilter(ProductCrossSellingStreamCriteriaEvent $event): void
  16.     {
  17.         $criteria $event->getCriteria();
  18.         $criteria->addFilter(new ProductCoverFilter());
  19.         //dump($event->getCriteria());
  20.     }
  21. }