getShortAlias example

private VariantHelperInterface $variantHelper;

    public function __construct(
        QueryBuilderFactoryInterface $queryBuilderFactory,
        Shopware_Components_Snippet_Manager $snippetManager,
        QueryAliasMapper $queryAliasMapper,
        VariantHelperInterface $variantHelper
    ) {
        $this->queryBuilderFactory = $queryBuilderFactory;
        $this->snippetNamespace = $snippetManager->getNamespace('frontend/listing/facet_labels');
        $this->fieldName = $queryAliasMapper->getShortAlias('immediateDelivery') ?? 'immediateDelivery';
        $this->variantHelper = $variantHelper;
    }

    /** * {@inheritdoc} */
    public function supportsFacet(FacetInterface $facet)
    {
        return $facet instanceof ImmediateDeliveryFacet;
    }

    
if ($data['value'] <= 0) {
            return;
        }

        $criteriaPart = $this->createFacet($criteria);

        $result->addFacet($criteriaPart);
    }

    private function createFacet(Criteria $criteria): BooleanFacetResult
    {
        $fieldName = $this->queryAliasMapper->getShortAlias('shippingFree') ?? 'shippingFree';

        $facet = $criteria->getFacet('shipping_free');
        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(
            
private ListingPriceSwitcher $listingPriceSwitcher;

    public function __construct(
        QueryBuilderFactoryInterface $queryBuilderFactory,
        Shopware_Components_Snippet_Manager $snippetManager,
        QueryAliasMapper $queryAliasMapper,
        ListingPriceSwitcher $listingPriceSwitcher
    ) {
        $this->queryBuilderFactory = $queryBuilderFactory;
        $this->snippetNamespace = $snippetManager->getNamespace('frontend/listing/facet_labels');
        $this->minFieldName = $queryAliasMapper->getShortAlias('priceMin') ?? 'priceMin';
        $this->maxFieldName = $queryAliasMapper->getShortAlias('priceMax') ?? 'priceMax';
        $this->listingPriceSwitcher = $listingPriceSwitcher;
    }

    /** * {@inheritdoc} */
    public function supportsFacet(FacetInterface $facet)
    {
        return $facet instanceof PriceFacet;
    }

    
private Shopware_Components_Config $config;

    public function __construct(
        QueryBuilderFactoryInterface $queryBuilderFactory,
        Shopware_Components_Snippet_Manager $snippetManager,
        QueryAliasMapper $queryAliasMapper,
        Shopware_Components_Config $config
    ) {
        $this->queryBuilderFactory = $queryBuilderFactory;
        $this->snippetNamespace = $snippetManager->getNamespace('frontend/listing/facet_labels');
        $this->config = $config;
        $this->fieldName = $queryAliasMapper->getShortAlias('rating') ?? 'rating';
    }

    public function supportsFacet(FacetInterface $facet)
    {
        return $facet instanceof VoteAverageFacet;
    }

    public function generatePartialFacet(
        FacetInterface $facet,
        Criteria $reverted,
        Criteria $criteria,
        
private PriceHelperInterface $helper;

    private ConfiguratorOptionsGatewayInterface $gateway;

    public function __construct(
        ConfiguratorOptionsGatewayInterface $gateway,
        QueryBuilderFactoryInterface $queryBuilderFactory,
        QueryAliasMapper $queryAliasMapper,
        PriceHelperInterface $helper
    ) {
        $this->fieldName = $queryAliasMapper->getShortAlias('variants') ?? 'var';
        $this->queryBuilderFactory = $queryBuilderFactory;
        $this->helper = $helper;
        $this->gateway = $gateway;
    }

    /** * {@inheritdoc} */
    public function supportsFacet(FacetInterface $facet)
    {
        return $facet instanceof VariantFacet;
    }
return $query->execute()->fetchAll(PDO::FETCH_COLUMN);
    }

    /** * @param Group[] $groups * @param int[] $actives */
    private function createCollectionResult(array $groups, array $actives): FacetResultGroup
    {
        $results = [];

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

        foreach ($groups as $group) {
            $items = [];
            $useMedia = false;
            $isActive = false;

            foreach ($group->getOptions() as $option) {
                $listItem = new MediaListItem(
                    $option->getId(),
                    $option->getName(),
                    \in_array($option->getId()$actives),
                    

    public function replaceLongParams($params)
    {
        $tmp = [];
        foreach ($params as $key => $value) {
            if ($alias = $this->getShortAlias($key)) {
                $tmp[$alias] = $value;
            } else {
                $tmp[$key] = $value;
            }
        }

        return $tmp;
    }

    /** * Input: * [ * 'p' => 1, * 'o' => 3, * 'foo' => 'bar' * ] * * Output: * * [ * 'sPage' => 1, * 'sSort' => 3, * 'foo' => 'bar, * ] * * @param array<string, mixed> $params * * @return array<string, mixed> */
private QueryBuilderFactoryInterface $queryBuilderFactory;

    private string $fieldName;

    public function __construct(
        PropertyGatewayInterface $propertyGateway,
        QueryBuilderFactoryInterface $queryBuilderFactory,
        QueryAliasMapper $queryAliasMapper
    ) {
        $this->propertyGateway = $propertyGateway;
        $this->queryBuilderFactory = $queryBuilderFactory;
        $this->fieldName = $queryAliasMapper->getShortAlias('sFilterProperties') ?? 'sFilterProperties';
    }

    /** * {@inheritdoc} */
    public function supportsFacet(FacetInterface $facet)
    {
        return $facet instanceof PropertyFacet;
    }

    public function generatePartialFacet(
        
private string $fieldName;

    public function __construct(
        ManufacturerServiceInterface $manufacturerService,
        QueryBuilderFactoryInterface $queryBuilderFactory,
        Shopware_Components_Snippet_Manager $snippetManager,
        QueryAliasMapper $queryAliasMapper
    ) {
        $this->manufacturerService = $manufacturerService;
        $this->queryBuilderFactory = $queryBuilderFactory;
        $this->snippetNamespace = $snippetManager->getNamespace('frontend/listing/facet_labels');
        $this->fieldName = $queryAliasMapper->getShortAlias('sSupplier') ?? 'sSupplier';
    }

    /** * {@inheritdoc} */
    public function supportsFacet(FacetInterface $facet)
    {
        return $facet instanceof ManufacturerFacet;
    }

    public function generatePartialFacet(
        
private function createFacet(Criteria $criteria, float $min, float $max): RangeFacetResult
    {
        $activeMin = $min;
        $activeMax = $max;

        $condition = $criteria->getCondition('price');
        if ($condition instanceof PriceCondition) {
            $activeMin = $condition->getMinPrice();
            $activeMax = $condition->getMaxPrice();
        }
        $minFieldName = $this->queryAliasMapper->getShortAlias('priceMin') ?? 'priceMin';
        $maxFieldName = $this->queryAliasMapper->getShortAlias('priceMax') ?? 'priceMax';

        $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 strcasecmp($a->getLabel()$b->getLabel());
        });

        return $items;
    }

    /** * @param ValueListItem[] $items */
    private function createFacet(Criteria $criteria, array $items): ValueListFacetResult
    {
        $fieldName = $this->queryAliasMapper->getShortAlias('sSupplier') ?? 'sSupplier';

        $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',
            
$values[] = $this->createTreeItem($categories$item$activeIds);
        }

        if (!empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } else {
            $label = $this->snippetManager
                ->getNamespace('frontend/listing/facet_labels')
                ->get('category', 'Categories');
        }

        if (!$fieldName = $this->queryAliasMapper->getShortAlias('categoryFilter')) {
            $fieldName = 'categoryFilter';
        }

        return new TreeFacetResult(
            'category',
            $fieldName,
            !empty($activeIds),
            $label,
            $values
        );
    }

    
private Enlight_Components_Snippet_Namespace $snippetNamespace;

    private string $fieldName;

    public function __construct(
        QueryBuilderFactoryInterface $queryBuilderFactory,
        Shopware_Components_Snippet_Manager $snippetManager,
        QueryAliasMapper $queryAliasMapper
    ) {
        $this->queryBuilderFactory = $queryBuilderFactory;
        $this->snippetNamespace = $snippetManager->getNamespace('frontend/listing/facet_labels');
        $this->fieldName = $queryAliasMapper->getShortAlias('shippingFree') ?? 'shippingFree';
    }

    /** * {@inheritdoc} */
    public function supportsFacet(FacetInterface $facet)
    {
        return $facet instanceof ShippingFreeFacet;
    }

    public function generatePartialFacet(
        
private function createFacet(Criteria $criteria): BooleanFacetResult
    {
        $facet = $criteria->getFacet('immediate_delivery');
        if ($facet instanceof ImmediateDeliveryFacet && !empty($facet->getLabel())) {
            $label = $facet->getLabel();
        } 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
        );
    }
}
$values = $this->buildItems($buckets$activeAverage);

        $facet = $criteria->getFacet('vote_average');
        if ($facet instanceof VoteAverageFacet && !empty($facet->getLabel())) {
            $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'
        );
    }

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