Added: check all and uncheck all option in the tree for normal products and scroll bar for the rendered tree

This commit is contained in:
vishalsingh.qlo325
2024-05-22 15:15:15 +05:30
parent 19c4e45320
commit 67a0b2dcf3
4 changed files with 27 additions and 8 deletions

View File

@@ -62,4 +62,8 @@
.tree-panel-label-title
font-weight: 400
margin: 0
@include padding(0, 0, 0, 8px)
@include padding(0, 0, 0, 8px)
.tree.cattree
max-height: 350px
overflow-y: auto

View File

@@ -48,17 +48,15 @@
}
{if isset($use_checkbox) && $use_checkbox == true}
function checkAllAssociatedCategories($tree)
function checkAllAssociatedHotels($tree)
{
$tree.find(':input[type=checkbox]').each(function(){
$(this).prop('checked', true);
addDefaultCategory($(this));
$(this).parent().addClass('tree-selected');
});
}
function uncheckAllAssociatedCategories($tree)
function uncheckAllAssociatedHotels($tree)
{
$tree.find(':input[type=checkbox]').each(function(){
$(this).prop('checked', false);

View File

@@ -382,6 +382,23 @@ class HelperTreeHotelsCore extends TreeCore
$this->addAction($expand_all);
if ($this->useCheckBox()) {
if ($this->useBulkActions()) {
$check_all = new TreeToolbarLink(
'Check All',
'#',
'checkAllAssociatedHotels($(\'#'.$this->getId().'\'));return false;',
'icon-check-sign');
$check_all->setAttribute('id', 'check-all-'.$this->getId());
$uncheck_all = new TreeToolbarLink(
'Uncheck All',
'#',
'uncheckAllAssociatedHotels($(\'#'.$this->getId().'\'));return false;',
'icon-check-empty');
$uncheck_all->setAttribute('id', 'uncheck-all-'.$this->getId());
$this->addAction($check_all);
$this->addAction($uncheck_all);
}
$this->setNodeFolderTemplate('tree_node_hotel_folder_checkbox.tpl');
$this->setNodeItemTemplate('tree_node_hotel_item_checkbox.tpl');
$this->setAttribute('use_checkbox', $this->useCheckBox());

View File

@@ -526,7 +526,7 @@ class AdminNormalProductsControllerCore extends AdminController
// convert price with the currency from context
$this->_list[$i]['price'] = Tools::convertPrice($this->_list[$i]['price'], $this->context->currency, true, $this->context);
$this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, null,
(int)Configuration::get('PS_PRICE_DISPLAY_PRECISION'), null, false, true, 1, true, null, null, null, $nothing, true, true,
(int)Configuration::get('PS_PRICE_DISPLAY_PRECISION'), null, false, true, 1, true, null, null, null, null, true, true,
$context);
}
}
@@ -2994,7 +2994,7 @@ class AdminNormalProductsControllerCore extends AdminController
->setUseSearch(false)
->setFullTree(0)
->setSelectedCategories($categories)
->setUseBulkActions(false);
->setUseBulkActions(true);
$data->assign(array('default_category' => $default_category,
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
@@ -3510,7 +3510,7 @@ class AdminNormalProductsControllerCore extends AdminController
->setRoomsOnly(false)
->setSelectedHotels($selectedElements['hotels'])
->setSelectedRoomTypes($selectedElements['room_types'])
->setUseBulkActions(false)
->setUseBulkActions(true)
->setAccessedHotels(HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 0));
$data->assign('hotel_tree', $tree->render());