/** * {@inheritdoc} */ public function install(array $fixtures) { $this->configWriter->save('sales/msrp/enabled', 1); foreach ($fixtures as $fileName) { $fileName = $this->fixtureManager->getFixture($fileName); if (!file_exists($fileName)) { continue; } $rows = $this->csvReader->getData($fileName); $header = array_shift($rows); foreach ($rows as $row) { $data = []; foreach ($row as $key => $value) { $data[$header[$key]] = $value; } $row = $data; $productId = $this->getProductIdBySku($row['sku']); if (!$productId) { continue; } /** @var \Magento\Catalog\Model\Product $product */ $product = $this->productCollection->getItemById($productId); $product->setMsrpDisplayActualPriceType(Type::TYPE_ON_GESTURE); if (!empty($row['msrp'])) { $price = $row['msrp']; } else { $price = $product->getPrice() * 1.1; } $product->setMsrp($price); $product->save(); } } }