/** * Create rewrite rules for categories * Default, deprecated method which updates rewrite URLs depending on the current shop * * @param null $offset * @param null $limit */ public function sCreateRewriteTableCategories($offset = null, $limit = null) { $routerCategoryTemplate = $this->config->get('routerCategoryTemplate'); if (empty($routerCategoryTemplate)) { return; } $parentId = Shopware()->Shop()->getCategory()->getId(); $categories = $this->modelManager->getRepository('Shopware\\Models\\Category\\Category')->getActiveChildrenList($parentId); if (isset($offset) && isset($limit)) { $categories = array_slice($categories, $offset, $limit); } $template = 'string:' . $routerCategoryTemplate; $template = $this->template->createTemplate($template, $this->data); foreach ($categories as $category) { if (!empty($category['external'])) { continue; } $template->assign('sCategory', $category); $path = $template->fetch(); $path = $this->sCleanupPath($path, false); if ($category['blog']) { $orgPath = 'sViewport=blog&sCategory=' . $category['id']; } else { $orgPath = 'sViewport=cat&sCategory=' . $category['id']; } $this->sInsertUrl($orgPath, $path); } }
/** * Creates a new template by name over the Enlight_Template_Manager. * * @param $template_name * @return Enlight_Template_Default */ public function createTemplate($template_name) { return $this->engine->createTemplate($template_name, $this->template); }