getEan example

$context = Context::createDefaultContext();
        $this->productRepository->create([$data]$context);

        $versionId = $this->productRepository->createVersion($id$context);
        $versionContext = $context->createWithVersionId($versionId);
        $this->productRepository->upsert([['id' => $id, 'ean' => 'updated']]$versionContext);

        /** @var ProductEntity $product */
        $product = $this->productRepository->search(new Criteria([$id])$versionContext)->first();
        static::assertInstanceOf(ProductEntity::class$product);
        static::assertSame('updated', $product->getEan());

        $product = $this->productRepository->search(new Criteria([$id])$context)->first();
        static::assertInstanceOf(ProductEntity::class$product);
        static::assertSame('EAN', $product->getEan());

        $this->productRepository->merge($versionId$context);
        $product = $this->productRepository->search(new Criteria([$id])$context)->first();
        static::assertInstanceOf(ProductEntity::class$product);
        static::assertSame('updated', $product->getEan());
    }

    
&& $this->hasProductGraduatedPrices($data['articleNumber']$order)
        ) {
            $data = $this->checkPrice($data$order$shopContext);
        }

        $variant = $this->getManager()->getRepository(ProductVariant::class)
            ->findOneBy(['number' => $data['articleNumber']]);

        // Load ean, unit and pack unit (translate if needed)         if ($variant instanceof ProductVariant) {
            $mainVariant = $variant->getArticle()->getMainDetail();
            $data['ean'] = $variant->getEan();
            if (!\is_string($data['ean']) && $mainVariant instanceof ProductVariant) {
                $data['ean'] = $mainVariant->getEan();
            }
            $unit = $variant->getUnit();
            if (!$unit instanceof Unit && $mainVariant instanceof ProductVariant) {
                $unit = $mainVariant->getUnit();
            }
            $data['unit'] = $unit instanceof Unit ? $unit->getName() : null;
            $data['packunit'] = $variant->getPackUnit();
            if (!\is_string($data['packunit']) && $mainVariant instanceof ProductVariant) {
                $data['packunit'] = $mainVariant->getPackUnit();
            }
$product->setAllowsNotification($listProduct->allowsNotification());
        $product->setHighlight($listProduct->highlight());
        $product->setUnit($listProduct->getUnit());
        $product->setTax($listProduct->getTax());
        $product->setPrices($listProduct->getPrices());
        $product->setManufacturer($listProduct->getManufacturer());
        $product->setCover($listProduct->getCover());
        $product->setCheapestPrice($listProduct->getCheapestPrice());
        $product->setName($listProduct->getName());
        $product->setAdditional($listProduct->getAdditional());
        $product->setCloseouts($listProduct->isCloseouts());
        $product->setEan($listProduct->getEan());
        $product->setHeight($listProduct->getHeight());
        $product->setKeywords($listProduct->getKeywords());
        $product->setLength($listProduct->getLength());
        $product->setLongDescription($listProduct->getLongDescription());
        $product->setMinStock($listProduct->getMinStock());
        $product->setReleaseDate($listProduct->getReleaseDate());
        $product->setShippingTime($listProduct->getShippingTime());
        $product->setShortDescription($listProduct->getShortDescription());
        $product->setStock($listProduct->getStock());
        $product->setWeight($listProduct->getWeight());
        $product->setWidth($listProduct->getWidth());
        

    protected function getMappingData($mainDetail$mapping)
    {
        $mainData = [];
        if ($mapping['settings']) {
            $mainData['supplierNumber'] = $mainDetail->getSupplierNumber();
            $mainData['weight'] = $mainDetail->getWeight();
            $mainData['stockMin'] = $mainDetail->getStockMin();
            $mainData['ean'] = $mainDetail->getEan();
            $mainData['minPurchase'] = $mainDetail->getMinPurchase();
            $mainData['purchaseSteps'] = $mainDetail->getPurchaseSteps();
            $mainData['maxPurchase'] = $mainDetail->getMaxPurchase();
            $mainData['releaseDate'] = $mainDetail->getReleaseDate();
            $mainData['shippingTime'] = $mainDetail->getShippingTime();
            $mainData['shippingFree'] = $mainDetail->getShippingFree();
            $mainData['width'] = $mainDetail->getWidth();
            $mainData['height'] = $mainDetail->getHeight();
            $mainData['len'] = $mainDetail->getLen();
            $mainData['lastStock'] = $mainDetail->getLastStock();
        }
        
'filtergroupID' => null,
            'priceStartingFrom' => null,
            'pseudopricePercent' => null,
            // Flag inside mini product             'sVariantArticle' => null,
            'sConfigurator' => $product->hasConfigurator(),
            // Only used for full products             'metaTitle' => $product->getMetaTitle(),
            'shippingfree' => $product->isShippingFree(),
            'suppliernumber' => $product->getManufacturerNumber(),
            'notification' => $product->allowsNotification(),
            'ean' => trim((string) $product->getEan()),
            'keywords' => $product->getKeywords(),
            'template' => $product->getTemplate(),
            'attributes' => $product->getAttributes(),
            'allowBuyInListing' => $product->allowBuyInListing(),
        ];

        if ($product->hasAttribute('core')) {
            $attributes = $product->getAttribute('core')->toArray();
            unset($attributes['id']$attributes['articleID']$attributes['articledetailsID']);

            $data = array_merge($data$attributes);
        }
Home | Imprint | This part of the site doesn't use cookies.