custom/plugins/SwagCustomizedProducts/src/Core/Checkout/Document/DocumentSubscriber.php line 25

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\Checkout\Document;
  8. use Shopware\Core\Checkout\Document\Event\DocumentOrderCriteriaEvent;
  9. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  10. class DocumentSubscriber implements EventSubscriberInterface
  11. {
  12.     /**
  13.      * {@inheritdoc}
  14.      */
  15.     public static function getSubscribedEvents(): array
  16.     {
  17.         return [
  18.             DocumentOrderCriteriaEvent::class => 'addCustomizedProducts',
  19.         ];
  20.     }
  21.     public function addCustomizedProducts(DocumentOrderCriteriaEvent $event): void
  22.     {
  23.         $criteria $event->getCriteria();
  24.         $criteria->addAssociation('lineItems.product.swagCustomizedProductsTemplate.options.values.prices');
  25.         $criteria->addAssociation('lineItems.product.swagCustomizedProductsTemplate.options.prices');
  26.     }
  27. }