<?php
namespace TomRockets\Subscriber;
use Shopware\Core\Content\Product\Events\ProductListingCriteriaEvent;
use Shopware\Core\Content\Product\Events\ProductListingResultEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ProductListingLoader implements EventSubscriberInterface
{
/**
* @inheritDoc
*/
public static function getSubscribedEvents()
{
return [
ProductListingCriteriaEvent::class => 'onListingLoad'
];
}
public function onListingLoad(ProductListingCriteriaEvent $event)
{
$event->getCriteria()->addAssociation('manufacturer.media');
}
}