/** * Returns the rows from the CSV file up to the maximum count * * @param \Aimeos\MW\Container\Content\Iface $content CSV content object * @param integer $maxcnt Maximum number of rows that should be retrieved at once * @param integer $codePos Column position which contains the unique product code (starting from 0) * @return array List of arrays with product codes as keys and list of values from the CSV file */ protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos) { $count = 0; $data = array(); while ($content->valid() && $count++ < $maxcnt) { $row = $content->current(); $data[$row[$codePos]] = $row; $content->next(); } return $data; }
/** * Imports the text content using the given text types. * * @param \Aimeos\MW\Container\Content\Iface $contentItem Content item containing texts and associated data * @param array $textTypeMap Associative list of text type IDs as keys and text type codes as values * @param string $domain Name of the domain this text belongs to, e.g. product, catalog, attribute * @return void */ protected function importTextsFromContent(\Aimeos\MW\Container\Content\Iface $contentItem, array $textTypeMap, $domain) { $count = 0; $codeIdMap = array(); $context = $this->getContext(); $textManager = \Aimeos\MShop\Text\Manager\Factory::createManager($context); $manager = \Aimeos\MShop\Factory::createManager($context, $domain); $contentItem->next(); // skip description row while (($row = $contentItem->current()) !== null) { $codeIdMap = $this->importTextRow($textManager, $row, $textTypeMap, $codeIdMap, $domain); if (++$count == 1000) { $this->importReferences($manager, $codeIdMap, $domain); $codeIdMap = array(); $count = 0; } $contentItem->next(); } if (!empty($codeIdMap)) { $this->importReferences($manager, $codeIdMap, $domain); } }