Merge pull request #580 from shreesh-webkul/patch-category
Updated: removed unused configuration options from admin catagory tab
This commit is contained in:
@@ -81,17 +81,18 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'title' => $this->l('Position'),
|
||||
'filter_key' => 'sa!position',
|
||||
'position' => 'position',
|
||||
'align' => 'center'
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Displayed'),
|
||||
'active' => 'status',
|
||||
'type' => 'bool',
|
||||
'class' => 'fixed-width-xs',
|
||||
'align' => 'center',
|
||||
'ajax' => true,
|
||||
'orderby' => false
|
||||
)
|
||||
'class' => 'fixed-width-sm'
|
||||
),
|
||||
// 'active' => array(
|
||||
// 'title' => $this->l('Displayed'),
|
||||
// 'active' => 'status',
|
||||
// 'type' => 'bool',
|
||||
// 'class' => 'fixed-width-xs',
|
||||
// 'align' => 'center',
|
||||
// 'ajax' => true,
|
||||
// 'orderby' => false
|
||||
// )
|
||||
);
|
||||
|
||||
$this->bulk_actions = array(
|
||||
@@ -421,7 +422,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$obj = $this->loadObject(true);
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$selected_categories = array((isset($obj->id_parent) && $obj->isParentCategoryAvailable($id_shop))? (int)$obj->id_parent : (int)Tools::getValue('id_parent', Category::getRootCategory()->id));
|
||||
$selected_categories = array((isset($obj->id_parent) && $obj->isParentCategoryAvailable($id_shop))? (int)$obj->id_parent : (int)Tools::getValue('id_parent', Configuration::get('PS_SERVICE_CATEGORY')));
|
||||
$unidentified = new Group(Configuration::get('PS_UNIDENTIFIED_GROUP'));
|
||||
$guest = new Group(Configuration::get('PS_GUEST_GROUP'));
|
||||
$default = new Group(Configuration::get('PS_CUSTOMER_GROUP'));
|
||||
@@ -479,25 +480,25 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'class' => 'copy2friendlyUrl',
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Displayed'),
|
||||
'name' => 'active',
|
||||
'required' => false,
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
)
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Displayed'),
|
||||
// 'name' => 'active',
|
||||
// 'required' => false,
|
||||
// 'is_bool' => true,
|
||||
// 'values' => array(
|
||||
// array(
|
||||
// 'id' => 'active_on',
|
||||
// 'value' => 1,
|
||||
// 'label' => $this->l('Enabled')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'active_off',
|
||||
// 'value' => 0,
|
||||
// 'label' => $this->l('Disabled')
|
||||
// )
|
||||
// )
|
||||
// ),
|
||||
array(
|
||||
'type' => 'categories',
|
||||
'label' => $this->l('Parent category'),
|
||||
@@ -509,80 +510,80 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'root_category' => Configuration::get('PS_SERVICE_CATEGORY')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description'),
|
||||
'name' => 'description',
|
||||
'autoload_rte' => true,
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Category Cover Image'),
|
||||
'name' => 'image',
|
||||
'display_image' => true,
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1',
|
||||
'hint' => $this->l('This is the main image for your category, displayed in the category page. The category description will overlap this image and appear in its top-left corner.'),
|
||||
'format' => $format['category']
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Category thumbnail'),
|
||||
'name' => 'thumb',
|
||||
'display_image' => true,
|
||||
'image' => $thumb_url ? $thumb_url : false,
|
||||
'size' => $thumb_size,
|
||||
'format' => $format['medium']
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Meta title'),
|
||||
'name' => 'meta_title',
|
||||
'maxchar' => 70,
|
||||
'lang' => true,
|
||||
'rows' => 5,
|
||||
'cols' => 100,
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Meta description'),
|
||||
'name' => 'meta_description',
|
||||
'maxchar' => 160,
|
||||
'lang' => true,
|
||||
'rows' => 5,
|
||||
'cols' => 100,
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'tags',
|
||||
'label' => $this->l('Meta keywords'),
|
||||
'name' => 'meta_keywords',
|
||||
'lang' => true,
|
||||
'hint' => $this->l('To add "tags," click in the field, write something, and then press "Enter."').' '.$this->l('Forbidden characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Friendly URL'),
|
||||
'name' => 'link_rewrite',
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Only letters, numbers, underscore (_) and the minus (-) character are allowed.')
|
||||
),
|
||||
array(
|
||||
'type' => 'group',
|
||||
'label' => $this->l('Group access'),
|
||||
'name' => 'groupBox',
|
||||
'values' => Group::getGroups(Context::getContext()->language->id),
|
||||
'info_introduction' => $this->l('You now have three default customer groups.'),
|
||||
'unidentified' => $unidentified_group_information,
|
||||
'guest' => $guest_group_information,
|
||||
'customer' => $default_group_information,
|
||||
'hint' => $this->l('Mark all of the customer groups which you would like to have access to this category.')
|
||||
)
|
||||
// array(
|
||||
// 'type' => 'textarea',
|
||||
// 'label' => $this->l('Description'),
|
||||
// 'name' => 'description',
|
||||
// 'autoload_rte' => true,
|
||||
// 'lang' => true,
|
||||
// 'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'file',
|
||||
// 'label' => $this->l('Category Cover Image'),
|
||||
// 'name' => 'image',
|
||||
// 'display_image' => true,
|
||||
// 'image' => $image_url ? $image_url : false,
|
||||
// 'size' => $image_size,
|
||||
// 'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->_category->id.'&token='.$this->token.'&deleteImage=1',
|
||||
// 'hint' => $this->l('This is the main image for your category, displayed in the category page. The category description will overlap this image and appear in its top-left corner.'),
|
||||
// 'format' => $format['category']
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'file',
|
||||
// 'label' => $this->l('Category thumbnail'),
|
||||
// 'name' => 'thumb',
|
||||
// 'display_image' => true,
|
||||
// 'image' => $thumb_url ? $thumb_url : false,
|
||||
// 'size' => $thumb_size,
|
||||
// 'format' => $format['medium']
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'label' => $this->l('Meta title'),
|
||||
// 'name' => 'meta_title',
|
||||
// 'maxchar' => 70,
|
||||
// 'lang' => true,
|
||||
// 'rows' => 5,
|
||||
// 'cols' => 100,
|
||||
// 'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'textarea',
|
||||
// 'label' => $this->l('Meta description'),
|
||||
// 'name' => 'meta_description',
|
||||
// 'maxchar' => 160,
|
||||
// 'lang' => true,
|
||||
// 'rows' => 5,
|
||||
// 'cols' => 100,
|
||||
// 'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'tags',
|
||||
// 'label' => $this->l('Meta keywords'),
|
||||
// 'name' => 'meta_keywords',
|
||||
// 'lang' => true,
|
||||
// 'hint' => $this->l('To add "tags," click in the field, write something, and then press "Enter."').' '.$this->l('Forbidden characters:').' <>;=#{}'
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'label' => $this->l('Friendly URL'),
|
||||
// 'name' => 'link_rewrite',
|
||||
// 'lang' => true,
|
||||
// 'required' => true,
|
||||
// 'hint' => $this->l('Only letters, numbers, underscore (_) and the minus (-) character are allowed.')
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'group',
|
||||
// 'label' => $this->l('Group access'),
|
||||
// 'name' => 'groupBox',
|
||||
// 'values' => Group::getGroups(Context::getContext()->language->id),
|
||||
// 'info_introduction' => $this->l('You now have three default customer groups.'),
|
||||
// 'unidentified' => $unidentified_group_information,
|
||||
// 'guest' => $guest_group_information,
|
||||
// 'customer' => $default_group_information,
|
||||
// 'hint' => $this->l('Mark all of the customer groups which you would like to have access to this category.')
|
||||
// )
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
@@ -736,6 +737,13 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('The category cannot be a parent of itself.');
|
||||
}
|
||||
}
|
||||
// @todo remove this after adding link_rewrite form option
|
||||
// currently have removed link_rewrite as it is currently not required
|
||||
// so adding link_rewrite in $_POST
|
||||
foreach (Language::getLanguages(true) as $lang) {
|
||||
$_POST['link_rewrite_'.$lang['id_lang']] = Tools::link_rewrite(Tools::getValue('name_'.$lang['id_lang']));
|
||||
}
|
||||
|
||||
$object = parent::processAdd();
|
||||
|
||||
//if we create a you root category you have to associate to a shop before to add sub categories in. So we redirect to AdminCategories listing
|
||||
@@ -745,6 +753,22 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function processUpdate()
|
||||
{
|
||||
// @todo remove this after adding link_rewrite form option
|
||||
// currently have removed link_rewrite as it is currently not required
|
||||
// so adding link_rewrite in $_POST
|
||||
if (!Validate::isLoadedObject($this->object)) {
|
||||
foreach (Language::getLanguages(true) as $lang) {
|
||||
$_POST['link_rewrite_'.$lang['id_lang']] = Tools::link_rewrite(Tools::getValue('name_'.$lang['id_lang']));
|
||||
}
|
||||
} else {
|
||||
foreach (Language::getLanguages(true) as $lang) {
|
||||
$_POST['link_rewrite_'.$lang['id_lang']] = $this->object->link_rewrite[$lang['id_lang']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function setDeleteMode()
|
||||
{
|
||||
if ($this->delete_mode == 'link' || $this->delete_mode == 'linkanddisable') {
|
||||
|
||||
Reference in New Issue
Block a user