<?php declare(strict_types=1);
namespace Wx\LoadVariants\Subscriber;
use Shopware\Core\Content\Product\Events\ProductListingCriteriaEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MySubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
ProductListingCriteriaEvent::class => 'handleRequest',
];
}
public function handleRequest(ProductListingCriteriaEvent $event): void
{
$event
->getCriteria()
->addAssociation('children');
/*
$event
->getCriteria()
->addAssociation('children.media');
*/
$event
->getCriteria()
->addAssociation('children.options');
}
}