custom/plugins/CogiCloseout/src/Subscriber/StorefrontSubscriber.php line 30

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Cogi\Closeout\Subscriber;
  3. use Cogi\Closeout\Core\Service\CloseoutService;
  4. use Shopware\Core\Content\Product\ProductEvents;
  5. use Shopware\Core\Framework\Context;
  6. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. class StorefrontSubscriber implements EventSubscriberInterface
  9. {
  10.     private $closeoutService;
  11.     public function __construct(
  12.         CloseoutService $closeoutService
  13.     )
  14.     {
  15.         $this->closeoutService $closeoutService;
  16.     }
  17.     public static function getSubscribedEvents(): array
  18.     {
  19.         return [
  20.             ProductEvents::PRODUCT_CONFIGURATOR_SETTING_LOADED_EVENT => 'onProductConfiguratorSettingLoaded'
  21.             // ProductPageLoadedEvent::class => 'onProductPageLoadedEvent'
  22.         ];
  23.     }
  24.     public function onProductConfiguratorSettingLoaded(EntityLoadedEvent $event): void
  25.     {
  26.         if ($event->getContext()->getScope() === Context::USER_SCOPE) {
  27.             $event $this->closeoutService->getCloseoutOptions($event);
  28.         }
  29.     }
  30.     /*
  31.     public function onProductPageLoadedEvent(ProductPageLoadedEvent $event): void
  32.     {
  33.         $cogiConfiguratorSettings = $this->closeoutService->getCloseoutOptionsPageLoaded($event);
  34.         $event->getPage()->setConfiguratorSettings($cogiConfiguratorSettings);
  35.     }
  36.     */
  37. }