/** * Adds all texts belonging to an catalog item. * * @param \Aimeos\MW\Container\Content\Iface $contentItem Content item * @param \Aimeos\MShop\Catalog\Item\Iface $item product item object * @param string $langid Language id */ protected function addItem(\Aimeos\MW\Container\Content\Iface $contentItem, \Aimeos\MShop\Catalog\Item\Iface $item, $langid) { $listTypes = array(); foreach ($item->getListItems('text') as $listItem) { $listTypes[$listItem->getRefId()] = $listItem->getType(); } foreach ($this->getTextTypes('catalog') as $textTypeItem) { $textItems = $item->getRefItems('text', $textTypeItem->getCode()); if (!empty($textItems)) { foreach ($textItems as $textItem) { $listType = isset($listTypes[$textItem->getId()]) ? $listTypes[$textItem->getId()] : ''; $items = array($langid, $item->getLabel(), $item->getId(), $listType, $textTypeItem->getCode(), '', ''); // use language of the text item because it may be null if (($textItem->getLanguageId() == $langid || is_null($textItem->getLanguageId())) && $textItem->getTypeId() == $textTypeItem->getId()) { $items[0] = $textItem->getLanguageId(); $items[5] = $textItem->getId(); $items[6] = $textItem->getContent(); } $contentItem->add($items); } } else { $items = array($langid, $item->getLabel(), $item->getId(), 'default', $textTypeItem->getCode(), '', ''); $contentItem->add($items); } } }
/** * Closes the site map content object * * @param \Aimeos\MW\Container\Content\Iface $content */ protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) { $config = $this->getContext()->getConfig(); /** controller/jobs/product/export/standard/template-footer * Relative path to the XML site map footer template of the product site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map footer. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map footer * @since 2015.01 * @category Developer * @see controller/jobs/product/export/standard/template-header * @see controller/jobs/product/export/standard/template-items * @see controller/jobs/product/export/standard/template-index */ $tplconf = 'controller/jobs/product/export/standard/template-footer'; $default = 'product/export/items-footer-default.xml'; $view = $this->getContext()->getView(); $content->add($view->render($this->getTemplate($tplconf, $default))); }
/** * 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); } }