getCovers example


    public function getList($ids, ShopContextInterface $context)
    {
        return $this->mediaGateway->getList($ids$context);
    }

    /** * {@inheritdoc} */
    public function getCover(BaseProduct $product, ShopContextInterface $context)
    {
        $covers = $this->getCovers([$product]$context);

        return array_shift($covers);
    }

    /** * {@inheritdoc} */
    public function getCovers($products, ShopContextInterface $context)
    {
        if ($this->shopwareConfig->get('forceArticleMainImageInListing')) {
            return $this->productMediaGateway->getCovers(
                
VariantMediaGatewayInterface $variantMedia
    ) {
        $this->productMediaGateway = $productMedia;
        $this->variantMediaGateway = $variantMedia;
    }

    /** * {@inheritdoc} */
    public function getList($products, ShopContextInterface $context)
    {
        $covers = $this->variantMediaGateway->getCovers(
            $products,
            $context
        );

        $fallback = [];
        foreach ($products as $product) {
            if (!\array_key_exists($product->getNumber()$covers)) {
                $fallback[] = $product;
            }
        }

        
/** * {@inheritdoc} */
    public function getList(array $numbers, ShopContextInterface $context)
    {
        // faster replacement for array_unique()         // see http://stackoverflow.com/questions/8321620/array-unique-vs-array-flip         $numbers = array_keys(array_flip($numbers));

        $products = $this->productGateway->getList($numbers$context);

        $covers = $this->mediaService->getCovers($products$context);

        $graduatedPrices = $this->graduatedPricesService->getList($products$context);

        $cheapestPrices = $this->cheapestPriceService->getList($products$context);

        $voteAverages = $this->voteService->getAverages($products$context);

        $categories = $this->categoryService->getProductsCategories($products$context);

        $manufacturerCovers = $this->mediaService->getList($this->getManufacturerCoverIds($products)$context);

        

        $media = $this->getList([$product]$context);

        return array_shift($media);
    }

    /** * {@inheritdoc} */
    public function getCover(BaseProduct $product, ShopContextInterface $context)
    {
        $covers = $this->getCovers([$product]$context);

        return array_shift($covers);
    }

    /** * {@inheritdoc} */
    public function getList($products, ShopContextInterface $context)
    {
        $ids = [];
        foreach ($products as $product) {
            

    public function getPositionImages($shopPositions)
    {
        $shopPositionImages = [];

        foreach ($shopPositions as $shopId => $positions) {
            $context = $this->get(ContextServiceInterface::class)->createShopContext($shopId);

            $shopPositionImages[$shopId] = $this->get(MediaServiceInterface::class)->getCovers(
                $positions,
                $context
            );

            $shopPositionImages[$shopId] = array_map(
                function D$mediaStruct) {
                    return $this->get(LegacyStructConverter::class)->convertMediaStruct($mediaStruct);
                },
                $shopPositionImages[$shopId]
            );
        }

        

        $media = $this->getList([$product]$context);

        return array_shift($media);
    }

    /** * {@inheritdoc} */
    public function getCover(BaseProduct $product, ShopContextInterface $context)
    {
        $covers = $this->getCovers([$product]$context);

        return array_shift($covers);
    }

    /** * {@inheritdoc} */
    public function getList($products, ShopContextInterface $context)
    {
        $ids = [];
        foreach ($products as $product) {
            
Home | Imprint | This part of the site doesn't use cookies.