getImages example

Context::createDefaultContext(),
            $listingResponse
        );

        static::assertNull($extension->getLocalId());
        static::assertNull($extension->getLicense());
        static::assertNull($extension->getVersion());
        static::assertEquals($listingResponse['name']$extension->getName());
        static::assertEquals($listingResponse['label']$extension->getLabel());

        static::assertInstanceOf(VariantCollection::class$extension->getVariants());
        static::assertInstanceOf(ImageCollection::class$extension->getImages());
        static::assertInstanceOf(BinaryCollection::class$extension->getBinaries());
    }

    public function testLoadsExtensionsFromListingArray(): void
    {
        $listingResponse = $this->getListingResponseFixture();

        $extensions = $this->extensionLoader->loadFromListingArray(
            Context::createDefaultContext(),
            $listingResponse
        );

        

    protected function prepareImageAssociation($data, ProductModel $article, Detail $variant)
    {
        if (empty($data['images'])) {
            if ($variant->getImages()->count() > 0) {
                foreach ($variant->getImages() as $image) {
                    $mapping = $this->getVariantMappingOfImage($image$variant);

                    if ($mapping) {
                        $this->getManager()->remove($mapping);
                    }
                }
            }

            return $data;
        }

        
/** * Generate the main thumbnails of a product * * @param bool $force Force to regenerate main thumbnails */
    public function generateMainThumbnails(ProductModel $article$force = false)
    {
        $generator = $this->getContainer()->get(Manager::class);

        $mediaService = Shopware()->Container()->get(MediaServiceInterface::class);

        foreach ($article->getImages() as $image) {
            $media = $image->getMedia();

            $projectDir = $this->getContainer()->getParameter('shopware.app.rootDir');

            if (!\is_string($projectDir)) {
                throw new RuntimeException('Parameter shopware.app.rootDir has to be a string');
            }

            if (!$force && $mediaService->has($projectDir . $media->getPath())) {
                continue;
            }

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