custom/plugins/SwagCustomizedProducts/src/Core/Content/Product/SalesChannel/SalesChannelProductSubscriber.php line 22

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /*
  3.  * (c) shopware AG <info@shopware.com>
  4.  * For the full copyright and license information, please view the LICENSE
  5.  * file that was distributed with this source code.
  6.  */
  7. namespace Swag\CustomizedProducts\Core\Content\Product\SalesChannel;
  8. use Shopware\Core\Content\Product\Events\ProductListingCriteriaEvent;
  9. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  10. class SalesChannelProductSubscriber implements EventSubscriberInterface
  11. {
  12.     public static function getSubscribedEvents(): array
  13.     {
  14.         return [
  15.             ProductListingCriteriaEvent::class => 'addCustomizedProductsListingAssociation',
  16.         ];
  17.     }
  18.     public function addCustomizedProductsListingAssociation(ProductListingCriteriaEvent $event): void
  19.     {
  20.         $criteria $event->getCriteria();
  21.         $criteria->addAssociation('swagCustomizedProductsTemplate.options');
  22.     }
  23. }