getSystemDefaultSorting example

 {
    }

    public function getDecorated(): AbstractListingProcessor
    {
        throw new DecorationPatternException(self::class);
    }

    public function prepare(Request $request, Criteria $criteria, SalesChannelContext $context): void
    {
        if (!$request->get('order')) {
            $request->request->set('order', $this->getSystemDefaultSorting($context));
        }

        /** @var ProductSortingCollection $sortings */
        $sortings = $criteria->getExtension('sortings') ?? new ProductSortingCollection();
        $sortings->merge($this->getAvailableSortings($request$context->getContext()));

        $currentSorting = $this->getCurrentSorting($sortings$request);

        $criteria->addSorting(
            ...$currentSorting->createDalSorting()
        );

        
Home | Imprint | This part of the site doesn't use cookies.