hasCondition example

$actives = [$actives];
            }
        }

        $items = array_map(function D$row) use ($actives) {
            return new ValueListItem($row$row, \in_array($row$actives));
        }$values);

        if ($criteriaPart->getMode() === ProductAttributeFacet::MODE_RADIO_LIST_RESULT) {
            return new RadioFacetResult(
                $criteriaPart->getName(),
                $criteria->hasCondition($criteriaPart->getName()),
                $criteriaPart->getLabel(),
                $items,
                $criteriaPart->getFormFieldName()
            );
        }

        return new ValueListFacetResult(
            $criteriaPart->getName(),
            $criteria->hasCondition($criteriaPart->getName()),
            $criteriaPart->getLabel(),
            $items,
            
$activeMax = $condition->$method();
        }

        if ($min === $max) {
            return null;
        }

        $label = $facet->getLabel() ?? '';

        return new RangeFacetResult(
            $name,
            $criteria->hasCondition($name),
            $label,
            $min,
            $max,
            $activeMin,
            $activeMax,
            $minField,
            $maxField,
            [],
            $facet->getSuffix(),
            3,
            'frontend/listing/filter/facet-range.tpl'
        );
 else {
            $label = $this->snippetManager
                ->getNamespace('frontend/listing/facet_labels')
                ->get('immediate_delivery', 'Immediate delivery');
        }

        $fieldName = $this->queryAliasMapper->getShortAlias('immediateDelivery') ?? 'immediateDelivery';

        return new BooleanFacetResult(
            'immediate_delivery',
            $fieldName,
            $criteria->hasCondition('immediate_delivery'),
            $label
        );
    }
}
if ($facet instanceof ShippingFreeFacet && !empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetManager
                ->getNamespace('frontend/listing/facet_labels')
                ->get('shipping_free', 'Shipping free');
        }

        return new BooleanFacetResult(
            'shipping_free',
            $fieldName,
            $criteria->hasCondition('shipping_free'),
            $label
        );
    }
}
$label = $facet->getLabel();
        } else {
            $label = $this->snippetManager
                ->getNamespace('frontend/listing/facet_labels')
                ->get('vote_average', 'Ranking');
        }

        $fieldName = $this->queryAliasMapper->getShortAlias('rating') ?? 'rating';

        return new RadioFacetResult(
            'vote_average',
            $criteria->hasCondition('vote_average'),
            $label,
            $values,
            $fieldName,
            [],
            'frontend/listing/filter/facet-rating.tpl'
        );
    }

    /** * @param array<string, mixed> $data * * @return array<ValueListItem> */
return null;
        }

        if (!empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetNamespace->get($facet->getName(), 'Price');
        }

        return new RangeFacetResult(
            $facet->getName(),
            $criteria->hasCondition($facet->getName()),
            $label,
            $min,
            $max,
            $activeMin,
            $activeMax,
            $this->minFieldName,
            $this->maxFieldName,
            [],
            null,
            2,
            'frontend/listing/filter/facet-currency-range.tpl'
        );
return $this->getFacet($facet$reverted$criteria$context);
    }

    private function getFacet(
        CombinedConditionFacet $facet,
        Criteria $reverted,
        Criteria $criteria,
        ShopContextInterface $context
    ): ?BooleanFacetResult {
        $own = clone $reverted;

        if (!$criteria->hasCondition($facet->getName())) {
            foreach ($facet->getConditions() as $condition) {
                $own->addCondition($condition);
            }
        }

        $query = $this->queryBuilderFactory->createQuery($own$context);
        $query->select('1');
        $query->setMaxResults(1);

        $hasFacet = $query->execute()->fetch(PDO::FETCH_COLUMN);
        if (!$hasFacet) {
            
if ($min === $max) {
            return null;
        }

        $activeMin = round($activeMin$facet->getDigits());
        $activeMax = round($activeMax$facet->getDigits());

        $label = $facet->getLabel() ?? '';

        return new RangeFacetResult(
            $name,
            $criteria->hasCondition($name),
            $label,
            $min,
            $max,
            $activeMin,
            $activeMax,
            $minField,
            $maxField,
            [],
            $facet->getSuffix(),
            $facet->getDigits(),
            'frontend/listing/filter/facet-range.tpl'
        );


        if (!empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetNamespace->get($facet->getName(), 'Shipping free');
        }

        return new BooleanFacetResult(
            $facet->getName(),
            $this->fieldName,
            $criteria->hasCondition($facet->getName()),
            $label
        );
    }
}
$values = $this->buildItems($data$activeAverage);

        if (!empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetNamespace->get($facet->getName(), 'Shipping free');
        }

        return new RadioFacetResult(
            $facet->getName(),
            $criteria->hasCondition($facet->getName()),
            $label,
            $values,
            $this->fieldName,
            [],
            'frontend/listing/filter/facet-rating.tpl'
        );
    }

    private function joinVoteAverage(ShopContextInterface $context, QueryBuilder $query): void
    {
        $shopCondition = '';
        
$translation = $this->extractTranslations($row, '__attribute_' . $facet->getField());
            if ($translation !== null) {
                $viewName = $translation;
            }

            return new ValueListItem($row[$facet->getField()]$viewName, \in_array($row[$facet->getField()]$actives));
        }$result);

        if ($facet->getMode() === ProductAttributeFacet::MODE_RADIO_LIST_RESULT) {
            return new RadioFacetResult(
                $facet->getName(),
                $criteria->hasCondition($facet->getName()),
                $facet->getLabel(),
                $items,
                $facet->getFormFieldName()
            );
        }

        return new ValueListFacetResult(
            $facet->getName(),
            $criteria->hasCondition($facet->getName()),
            $facet->getLabel(),
            $items,
            
$facet = $criteria->getFacet('price');
        if ($facet instanceof PriceFacet && !empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetManager
                ->getNamespace('frontend/listing/facet_labels')
                ->get('price', 'Price');
        }

        return new RangeFacetResult(
            'price',
            $criteria->hasCondition('price'),
            $label,
            $min,
            $max,
            $activeMin,
            $activeMax,
            $minFieldName,
            $maxFieldName,
            [],
            null,
            2,
            'frontend/listing/filter/facet-currency-range.tpl'
        );


            $facet = $criteria->getFacet($key);
            if (!$facet instanceof CombinedConditionFacet) {
                continue;
            }

            $result->addFacet(
                new BooleanFacetResult(
                    $facet->getName(),
                    $facet->getRequestParameter(),
                    $criteria->hasCondition($facet->getName()),
                    $facet->getLabel()
                )
            );
        }
    }

    private function addQuery(
        CombinedConditionFacet $criteriaPart,
        Criteria $criteria,
        Search $search,
        ShopContextInterface $context
    ):
$facet = $criteria->getFacet('manufacturer');
        if ($facet instanceof ManufacturerFacet && !empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetManager->getNamespace('frontend/listing/facet_labels')
                ->get('manufacturer', 'Manufacturer');
        }

        return new ValueListFacetResult(
            'manufacturer',
            $criteria->hasCondition('manufacturer'),
            $label,
            $items,
            $fieldName
        );
    }
}
$this->connection = $connection;
    }

    /** * Traces the search result into the s_statistic_search */
    public function logResult(
        Criteria $criteria,
        ProductNumberSearchResult $result,
        Shop $shop
    ) {
        if (!$criteria->hasCondition('search')) {
            return;
        }

        $condition = $criteria->getCondition('search');
        if (!$condition instanceof SearchTermCondition) {
            return;
        }

        $now = new DateTime();
        $this->connection->insert('s_statistics_search', [
            'datum' => $now->format('Y-m-d H:i:s'),
            
Home | Imprint | This part of the site doesn't use cookies.