/** * {@inheritdoc} */ public function addMissingPrices(ProductValueInterface $value) { $activeCurrencyCodes = $this->currencyRepository->getActivatedCurrencyCodes(); if (AttributeTypes::PRICE_COLLECTION === $value->getAttribute()->getAttributeType()) { $prices = $value->getPrices(); foreach ($activeCurrencyCodes as $currencyCode) { if (null === $value->getPrice($currencyCode)) { $this->addPriceForCurrency($value, $currencyCode); } } foreach ($prices as $price) { if (!in_array($price->getCurrency(), $activeCurrencyCodes)) { $value->removePrice($price); } } } return $value; }
/** * @param ProductValueInterface $productValue * @param ProductValueInterface $value */ protected function setProductPrice(ProductValueInterface $productValue, ProductValueInterface $value) { foreach ($value->getPrices() as $price) { if (null === ($productPrice = $productValue->getPrice($price->getCurrency()))) { $productPrice = $this->productBuilder->addPriceForCurrency($productValue, $price->getCurrency()); } $productPrice->setData($price->getData()); } }