custom/static-plugins/NdFashion/src/Subscriber/ModifyProductListingRouteCacheKey.php line 18

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Nd\Fashion\Subscriber;
  3. use Shopware\Core\Content\Product\Events\ProductListingRouteCacheKeyEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class ModifyProductListingRouteCacheKey implements EventSubscriberInterface
  6. {
  7.     public static function getSubscribedEvents(): array
  8.     {
  9.         return [
  10.             ProductListingRouteCacheKeyEvent::class => 'onProductListingRouteCacheKeyGeneration'
  11.         ];
  12.     }
  13.     public function onProductListingRouteCacheKeyGeneration(ProductListingRouteCacheKeyEvent $event) {
  14.         $request $event->getRequest();
  15.         if($request->get('productManufacturerId') && strlen($request->get('productManufacturerId')) > 0){
  16.             $event->addPart($request->get('productManufacturerId'));
  17.         }
  18.     }
  19. }