public function getDecorated(): AbstractProductListingRoute
{ throw new DecorationPatternException(self::
class);
} #[Route(path: '/store-api/product-listing/{categoryId}', name: 'store-api.product.listing', methods: ['POST'], defaults: ['_entity' => 'product'])]
public function load(string
$categoryId, Request
$request, SalesChannelContext
$context, Criteria
$criteria): ProductListingRouteResponse
{ $criteria->
addFilter( new ProductAvailableFilter($context->
getSalesChannel()->
getId(), ProductVisibilityDefinition::VISIBILITY_ALL
) );
$criteria->
setTitle('product-listing-route::loading'
);
$categoryCriteria =
new Criteria([$categoryId]);
$categoryCriteria->
setTitle('product-listing-route::category-loading'
);
$categoryCriteria->
addFields(['productAssignmentType', 'productStreamId'
]);
$categoryCriteria->
setLimit(1
);
/** @var PartialEntity|null $category */
$category =
$this->categoryRepository->
search($categoryCriteria,
$context->
getContext())->
first();
if (!
$category) {