public function renderEditForm($tpl = null) { $this->loadObject(true); $app = JFactory::getApplication(); if (!isset($this->context)) { $this->context = JeproshopContext::getContext(); } $shop_id = JeproshopContext::getContext()->shop->shop_id; $selected_categories = array(isset($this->context->controller->category->parent_id) && $this->context->controller->category->isParentCategoryAvailable($shop_id) ? (int) $this->context->controller->category->parent_id : $app->input->get('parent_id', JeproshopCategoryModelCategory::getRootCategory()->category_id)); $unidentified = new JeproshopGroupModelGroup(JeproshopSettingModelSetting::getValue('unidentified_group')); $guest = new JeproshopGroupModelGroup(JeproshopSettingModelSetting::getValue('guest_group')); $default = new JeproshopGroupModelGroup(JeproshopSettingModelSetting::getValue('customer_group')); $unidentified_group_information = '<b>' . $unidentified->name[$this->context->language->lang_id] . '</b> ' . JText::_('COM_JEPROSHOP_ALL_PEOPLE_WITHOUT_A_VALID_CUSTOMER_ACCOUNT_MESSAGE'); $guest_group_information = '<b>' . $guest->name[$this->context->language->lang_id] . '</b> ' . JText::_('COM_JEPROSHOP_CUSTOMER_WHO_PLACED_AN_ORDER_WITH_THE_GUEST_CHECKOUT_MESSAGE'); $default_group_information = '<b>' . $default->name[$this->context->language->lang_id] . '</b> ' . JText::_('COM_JEPROSHOP_ALL_PEOPLE_WHO_HAVE_CREATED_AN_CREATED_AN_ACCOUNT_ON_THIS_SITE_MESSAGE'); $this->assignRef('unidentified_group_information', $unidentified_group_information); $this->assignRef('guest_group_information', $guest_group_information); $this->assignRef('default_group_information', $default_group_information); $image = COM_JEPROSHOP_CATEGORY_IMAGE_DIR . $this->context->controller->category->category_id . '.jpg'; $image_url = JeproshopImageManager::thumbnail($image, 'category_' . $this->context->controller->category->category_id . '.jpg', 350, 'jpg', true, true); $imageSize = file_exists($image) ? filesize($image) / 1000 : false; $shared_category = JeproshopTools::isLoadedObject($this->context->controller->category, 'category_id') && $this->context->controller->category->hasMultishopEntries(); $this->assignRef('shared_category', $shared_category); $allow_accented_chars_url = (int) JeproshopSettingModelSetting::getValue('allow_accented_chars_url'); $this->assignRef('allow_accented_chars_url', $allow_accented_chars_url); //$this->assignRef('selected_categories', $selected_categories); $categories_tree = new JeproshopCategoriesTree('jform_categories_tree', JText::_('COM_JEPROSHOP_CATEGORIES_LABEL'), null, $this->context->language->lang_id); $categories_tree->setTreeTemplate('associated_categories')->setSelectedCategories($selected_categories)->setUseCheckBox(true)->setInputName('parent_id'); $categories_data = $categories_tree->render(); $this->assignRef('categories_tree', $categories_data); $image = JeproshopImageManager::thumbnail(COM_JEPROSHOP_CATEGORY_IMAGE_DIR . '/' . $this->context->controller->category->category_id . '.jpg', 'category_' . (int) $this->context->controller->category->category_id . '.jpg', 350, 'jpg', true); $this->assignRef('image', $image ? $image : false); $size = $image ? filesize(COM_JEPROSHOP_CATEGORY_IMAGE_DIR . '/' . $this->context->controller->category->category_id . 'jpg') / 1000 : false; $this->assignRef('size', $size); $category_group_ids = $this->context->controller->category->getGroups(); $groups = JeproshopGroupModelGroup::getGroups($this->context->language->lang_id); //if empty $carrier_groups_ids : object creation : we set the default groups if (empty($category_group_ids)) { $preSelected = array(JeproshopSettingModelSetting::getValue('unidentified_group'), JeproshopSettingModelSetting::getValue('guest_group'), JeproshopSettingModelSetting::getValue('customer_group')); $category_group_ids = array_merge($category_group_ids, $preSelected); } foreach ($groups as $group) { $groupBox = $app->input->get('group_box_' . $group->group_id, in_array($group->group_id, $category_group_ids)); $this->assignRef('group_box_' . $group->group_id, $groupBox); } $is_root_category = (bool) $app->input->get('is_root_category'); $this->assignRef('is_root_category', $is_root_category); $helper = new JeproshopHelper(); $this->assignRef('helper', $helper); $this->assignRef('groups', $groups); $this->addToolBar(); $this->sideBar = JHtmlSideBar::render(); parent::display($tpl); }