/** * Adds all texts belonging to an catalog item. * * @param MW_Container_Content_Interface $contentItem Content item * @param MShop_Catalog_Item_Interface $item product item object * @param string $langid Language id */ protected function _addItem(MW_Container_Content_Interface $contentItem, MShop_Catalog_Item_Interface $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 MW_Container_Content_Interface $content */ protected function _closeContent(MW_Container_Content_Interface $content) { $config = $this->_getContext()->getConfig(); /** controller/jobs/product/export/sitemap/default/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 layouts directory (usually in * controller/jobs/layouts). * * 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 "default" 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, "default" * 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/sitemap/default/template-header * @see controller/jobs/product/export/sitemap/default/template-items * @see controller/jobs/product/export/sitemap/default/template-index */ $tplconf = 'controller/jobs/product/export/sitemap/default/template-footer'; $default = 'product/export/sitemap-items-footer-default.xml'; $view = $this->_getContext()->getView(); $content->add($view->render($this->_getTemplate($tplconf, $default))); }