/** * {@inheritdoc} */ public function install(array $productFixtures, array $galleryFixtures, array $downloadableFixtures = []) { foreach ($downloadableFixtures 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; $sku = $row['product_sku']; if (!isset($this->downloadableData[$sku])) { $this->downloadableData[$sku] = []; } $this->downloadableData[$sku] = $this->converter->getDownloadableData($row, $this->downloadableData[$sku]); $this->downloadableData[$sku]['sample'] = $this->converter->getSamplesInfo(); } } parent::install($productFixtures, $galleryFixtures); }
/** * {@inheritdoc} */ public function install() { $this->attributeSetup->install(['Magento_CatalogSampleData::fixtures/attributes.csv']); $this->categorySetup->install(['Magento_CatalogSampleData::fixtures/categories.csv']); $this->productSetup->install(['Magento_CatalogSampleData::fixtures/SimpleProduct/products_gear_bags.csv', 'Magento_CatalogSampleData::fixtures/SimpleProduct/products_gear_fitness_equipment.csv', 'Magento_CatalogSampleData::fixtures/SimpleProduct/products_gear_fitness_equipment_ball.csv', 'Magento_CatalogSampleData::fixtures/SimpleProduct/products_gear_fitness_equipment_strap.csv', 'Magento_CatalogSampleData::fixtures/SimpleProduct/products_gear_watches.csv'], ['Magento_CatalogSampleData::fixtures/SimpleProduct/images_gear_bags.csv', 'Magento_CatalogSampleData::fixtures/SimpleProduct/images_gear_fitness_equipment.csv', 'Magento_CatalogSampleData::fixtures/SimpleProduct/images_gear_watches.csv']); }
/** * Product constructor. * @param SampleDataContext $sampleDataContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\ConfigFactory $catalogConfig * @param \Magento\GroupedProductSampleData\Model\Product\Converter $converter * @param \Magento\Framework\Setup\SampleData\FixtureManager $fixtureManager * @param \Magento\CatalogSampleData\Model\Product\Gallery $gallery * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct(SampleDataContext $sampleDataContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\ConfigFactory $catalogConfig, \Magento\GroupedProductSampleData\Model\Product\Converter $converter, \Magento\Framework\Setup\SampleData\FixtureManager $fixtureManager, \Magento\CatalogSampleData\Model\Product\Gallery $gallery, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig) { parent::__construct($sampleDataContext, $productFactory, $catalogConfig, $converter, $gallery, $storeManager, $eavConfig); }
/** * Product constructor. * @param SampleDataContext $sampleDataContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\ConfigFactory $catalogConfig * @param Product\Converter $converter * @param \Magento\CatalogSampleData\Model\Product\Gallery $gallery * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct(SampleDataContext $sampleDataContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\ConfigFactory $catalogConfig, \Magento\BundleSampleData\Model\Product\Converter $converter, \Magento\CatalogSampleData\Model\Product\Gallery $gallery, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig) { $this->eavConfig = $eavConfig; parent::__construct($sampleDataContext, $productFactory, $catalogConfig, $converter, $gallery, $storeManager, $eavConfig); }