IsAvailableCondition example

$limit = min($limit$max);
        }
        $limit = max($limit, 1);
        $criteria->limit($limit);
    }

    private function addIsAvailableCondition(Criteria $criteria): void
    {
        if (!$this->config->get('hideNoInStock')) {
            return;
        }
        $criteria->addBaseCondition(new IsAvailableCondition());
    }

    private function addWeightCondition(Request $request, Criteria $criteria): void
    {
        $min = $request->getParam('minWeight');
        $max = $request->getParam('maxWeight');

        if (!$min && !$max) {
            return;
        }

        

    public function createBaseCriteria($categoryIds, ShopContextInterface $context)
    {
        $criteria = new Criteria();

        $criteria->addBaseCondition(new CategoryCondition($categoryIds));

        if ($this->config->get('hideNoInStock')) {
            $criteria->addBaseCondition(new IsAvailableCondition());
        }

        $criteria->addBaseCondition(
            new CustomerGroupCondition([$context->getCurrentCustomerGroup()->getId()])
        );

        $this->eventManager->notify('Shopware_SearchBundle_Create_Base_Criteria', [
            'criteria' => $criteria,
            'context' => $context,
            'categoryIds' => $categoryIds,
        ]);

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