Пример #1
0
 public function renderDetails($tpl = null)
 {
     $app = JFactory::getApplication();
     $category_id = $app->input->get('category_id');
     if (!isset($this->context) || empty($this->context)) {
         $this->context = JeproshopContext::getContext();
     }
     if (!JeproshopShopModelShop::isFeaturePublished() && count(JeproshopCategoryModelCategory::getCategoriesWithoutParent()) > 1 && $category_id) {
         $categories_tree = array(get_object_vars($this->context->controller->category->getTopCategory()));
     } else {
         $categories_tree = $this->context->controller->category->getParentsCategories();
         $end = end($categories_tree);
         if (isset($categories_tree) && !JeproshopShopModelShop::isFeaturePublished() && (isset($end) && $end->parent_id != 0)) {
             $categories_tree = array_merge($categories_tree, array(get_object_vars($this->context->controller->category->getTopCategory())));
         }
     }
     $count_categories_without_parent = count(JeproshopCategoryModelCategory::getCategoriesWithoutParent());
     if (empty($categories_tree) && ($this->context->controller->category->category_id != 1 || $category_id) && (JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP && !JeproshopShopModelShop::isFeaturePublished() && $count_categories_without_parent > 1)) {
         $categories_tree = array(array('name' => $this->context->controller->category->name[$this->context->language->lang_id]));
     }
     $categories_tree = array_reverse($categories_tree);
     $this->assignRef('categories_tree', $categories_tree);
     $this->assignRef('categories_tree_current_id', $this->context->controller->category->category_id);
     $categoryModel = new JeproshopCategoryModelCategory();
     $categories = $categoryModel->getCategoriesList();
     $pagination = $categoryModel->getPagination();
     $this->assignRef('pagination', $pagination);
     $this->assignRef('categories', $categories);
     $this->setLayout('default');
     $this->addToolBar();
     $this->sideBar = JHtmlSideBar::render();
     parent::display($tpl);
 }