From 41da9ae35b73a74ec6b7681aa4d896e2312f6b28 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 18 Mar 2024 09:42:54 +0530 Subject: [PATCH 1/6] Added: Accurate page name display in Visitors online stats page --- modules/statslive/statslive.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/statslive/statslive.php b/modules/statslive/statslive.php index bb9088d55..7ddd1e70c 100644 --- a/modules/statslive/statslive.php +++ b/modules/statslive/statslive.php @@ -45,6 +45,12 @@ class StatsLive extends Module $this->displayName = $this->l('Visitors online'); $this->description = $this->l('Adds a list of customers and visitors who are currently online to the Stats dashboard.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7.0.99'); + $this->page_map = array( + 'index' => 'home', + 'category' => 'hotel', + 'product' => 'room-type', + 'orderopc' => 'checkout' + ); } public function install() @@ -89,6 +95,7 @@ class StatsLive extends Module ORDER BY u.firstname, u.lastname'; } $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + $this->updatePageName($results); return array($results, Db::getInstance()->NumRows()); } @@ -130,10 +137,22 @@ class StatsLive extends Module } $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + $this->updatePageName($results); return array($results, Db::getInstance()->NumRows()); } + public function updatePageName(&$result) + { + if (count($result)) { + foreach ($result as &$customer) { + if (isset($this->page_map[$customer['page']])) { + $customer['page'] = $this->page_map[$customer['page']]; + } + } + } + } + public function hookAdminStatsModules($params) { list($customers, $total_customers) = $this->getCustomersOnline(); From 291514bbb56bb3d94535749ccd613d92f524dbaa Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 19 Mar 2024 14:55:57 +0530 Subject: [PATCH 2/6] created function for getting page alias --- classes/Page.php | 16 ++++++++++++++++ modules/statslive/statslive.php | 16 ++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/classes/Page.php b/classes/Page.php index f63641032..6f456d810 100644 --- a/classes/Page.php +++ b/classes/Page.php @@ -128,4 +128,20 @@ class PageCore extends ObjectModel )); } } + + public static function getPageTypeAlias($pageName) + { + $pageTypeAlias = array( + 'index' => 'home', + 'category' => 'hotel', + 'product' => 'room-type', + 'orderopc' => 'checkout' + ); + + if (isset($pageTypeAlias[$pageName])) { + return $pageTypeAlias[$pageName]; + } else { + return $pageName; + } + } } diff --git a/modules/statslive/statslive.php b/modules/statslive/statslive.php index 7ddd1e70c..afce68a5b 100644 --- a/modules/statslive/statslive.php +++ b/modules/statslive/statslive.php @@ -45,12 +45,6 @@ class StatsLive extends Module $this->displayName = $this->l('Visitors online'); $this->description = $this->l('Adds a list of customers and visitors who are currently online to the Stats dashboard.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7.0.99'); - $this->page_map = array( - 'index' => 'home', - 'category' => 'hotel', - 'product' => 'room-type', - 'orderopc' => 'checkout' - ); } public function install() @@ -95,7 +89,7 @@ class StatsLive extends Module ORDER BY u.firstname, u.lastname'; } $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - $this->updatePageName($results); + $this->updatePageTypeAlias($results); return array($results, Db::getInstance()->NumRows()); } @@ -137,18 +131,16 @@ class StatsLive extends Module } $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - $this->updatePageName($results); + $this->updatePageTypeAlias($results); return array($results, Db::getInstance()->NumRows()); } - public function updatePageName(&$result) + public function updatePageTypeAlias(&$result) { if (count($result)) { foreach ($result as &$customer) { - if (isset($this->page_map[$customer['page']])) { - $customer['page'] = $this->page_map[$customer['page']]; - } + $customer['page'] = Page::getPageTypeAlias($customer['page']); } } } From 64f98b57f85848145b024be64bf0c2758fa5bba7 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 19 Mar 2024 19:35:30 +0530 Subject: [PATCH 3/6] Fix chosen design issue at back office --- .../themes/default/sass/partials/_chosen.sass | 20 +++++++++---------- .../orders/helpers/list/list_header.tpl | 2 +- .../products/helpers/list/list_header.tpl | 2 +- js/admin.js | 1 - 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/admin/themes/default/sass/partials/_chosen.sass b/admin/themes/default/sass/partials/_chosen.sass index 00b3d01f0..358494e4f 100644 --- a/admin/themes/default/sass/partials/_chosen.sass +++ b/admin/themes/default/sass/partials/_chosen.sass @@ -298,15 +298,6 @@ $chosen-sprite-path: '../img/chosen-sprite.png' .search-field input color: #111 !important -.chosen-container-multi.chosen-options-horizontal .chosen-choices - max-height: 55px !important - white-space: nowrap - overflow-x: auto - -.chosen-container-multi.chosen-options-horizontal .chosen-choices li - float: none - display: inline-block - .chosen-disabled cursor: default opacity: 0.5 !important @@ -356,4 +347,13 @@ $chosen-sprite-path: '../img/chosen-sprite.png' padding: 4px 5px 4px 20px #list_filters_panel .chosen-container - width: 100% !important \ No newline at end of file + width: 100% !important + +#list_filters_panel .chosen-container-multi .chosen-choices + max-height: 55px !important + white-space: nowrap + overflow-x: auto + +#list_filters_panel .chosen-container-multi .chosen-choices li + float: none + display: inline-block \ No newline at end of file diff --git a/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl index 05ffd57c6..255b57976 100644 --- a/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/list/list_header.tpl @@ -250,7 +250,7 @@ {elseif $params.type == 'select'} {if isset($params.multiple) && $params.multiple} - {if isset($params.list) && is_array($params.list)} {foreach $params.list AS $option_value => $option_display} diff --git a/admin/themes/default/template/controllers/products/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/products/helpers/list/list_header.tpl index 0255b15c6..6801fde31 100644 --- a/admin/themes/default/template/controllers/products/helpers/list/list_header.tpl +++ b/admin/themes/default/template/controllers/products/helpers/list/list_header.tpl @@ -238,7 +238,7 @@ {elseif $params.type == 'select'} {if isset($params.multiple) && $params.multiple} - {if isset($params.list) && is_array($params.list)} {foreach $params.list AS $option_value => $option_display} diff --git a/js/admin.js b/js/admin.js index 60a8eba58..daae71858 100644 --- a/js/admin.js +++ b/js/admin.js @@ -767,7 +767,6 @@ $(document).ready(function() $(item).chosen({ disable_search_threshold: 5, search_contains: true, - inherit_select_classes: true, }); }); // Apply chosen() when modal is loaded From 60fd0c2c02c3b066ac83a590900c57369f4ef48b Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 21 Mar 2024 15:05:18 +0530 Subject: [PATCH 4/6] Added values for 'price_calculation_method' and 'price_addition_type' for demo service products --- .../hotelreservationsystem/classes/HotelHelper.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 2ddd664a8..2f32b0832 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -579,6 +579,7 @@ class HotelHelper 'price' => '250', 'auto_add_to_cart' => 1, 'show_at_front' => 0, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_DAY, 'price_addition_type' => Product::PRICE_ADDITION_TYPE_WITH_ROOM, ), array( @@ -588,6 +589,7 @@ class HotelHelper 'price' => '250', 'auto_add_to_cart' => 1, 'show_at_front' => 0, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_BOOKING, 'price_addition_type' => Product::PRICE_ADDITION_TYPE_INDEPENDENT, ), array( @@ -597,6 +599,7 @@ class HotelHelper 'price' => '50', 'auto_add_to_cart' => 0, 'show_at_front' => 1, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_BOOKING, 'price_addition_type' => Product::PRICE_ADDITION_TYPE_WITH_ROOM, ), array( @@ -606,6 +609,8 @@ class HotelHelper 'price' => '200', 'auto_add_to_cart' => 0, 'show_at_front' => 1, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_BOOKING, + 'price_addition_type' => Product::PRICE_ADDITION_TYPE_WITH_ROOM, ), array( 'name' => 'Breakfast', @@ -614,6 +619,8 @@ class HotelHelper 'price' => '350', 'auto_add_to_cart' => 0, 'show_at_front' => 1, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_BOOKING, + 'price_addition_type' => Product::PRICE_ADDITION_TYPE_WITH_ROOM, ), array( 'name' => 'Dinner', @@ -622,6 +629,8 @@ class HotelHelper 'price' => '450', 'auto_add_to_cart' => 0, 'show_at_front' => 1, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_BOOKING, + 'price_addition_type' => Product::PRICE_ADDITION_TYPE_WITH_ROOM, ), ); @@ -650,9 +659,8 @@ class HotelHelper $objProduct->auto_add_to_cart = $serviceProduct['auto_add_to_cart']; $objProduct->show_at_front = $serviceProduct['show_at_front']; $objProduct->available_for_order = 1; - if ($serviceProduct['auto_add_to_cart']) { - $objProduct->price_addition_type = $serviceProduct['price_addition_type']; - } + $objProduct->price_addition_type = $serviceProduct['price_addition_type']; + $objProduct->price_calculation_method = $serviceProduct['price_calculation_method']; $objProduct->is_virtual = 1; $objProduct->indexed = 1; $objProduct->save(); From a8b84baa0303517a3ddec973b11dca4facc38eb4 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 21 Mar 2024 17:30:27 +0530 Subject: [PATCH 5/6] Move sass contents --- admin/themes/default/sass/partials/_chosen.sass | 14 +------------- admin/themes/default/sass/partials/_commons.sass | 14 +++++++++++++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/admin/themes/default/sass/partials/_chosen.sass b/admin/themes/default/sass/partials/_chosen.sass index 358494e4f..b56215a15 100644 --- a/admin/themes/default/sass/partials/_chosen.sass +++ b/admin/themes/default/sass/partials/_chosen.sass @@ -344,16 +344,4 @@ $chosen-sprite-path: '../img/chosen-sprite.png' .chosen-search input background: url($chosen-sprite-path) no-repeat -28px -20px, $chosen-background direction: rtl - padding: 4px 5px 4px 20px - -#list_filters_panel .chosen-container - width: 100% !important - -#list_filters_panel .chosen-container-multi .chosen-choices - max-height: 55px !important - white-space: nowrap - overflow-x: auto - -#list_filters_panel .chosen-container-multi .chosen-choices li - float: none - display: inline-block \ No newline at end of file + padding: 4px 5px 4px 20px \ No newline at end of file diff --git a/admin/themes/default/sass/partials/_commons.sass b/admin/themes/default/sass/partials/_commons.sass index 588ef7d53..b44f11272 100644 --- a/admin/themes/default/sass/partials/_commons.sass +++ b/admin/themes/default/sass/partials/_commons.sass @@ -215,4 +215,16 @@ padding: 8px 12px text-transform: none label - font-weight: 400 \ No newline at end of file + font-weight: 400 + +#list_filters_panel .chosen-container + width: 100% !important + +#list_filters_panel .chosen-container-multi .chosen-choices + max-height: 55px !important + white-space: nowrap + overflow-x: auto + +#list_filters_panel .chosen-container-multi .chosen-choices li + float: none + display: inline-block \ No newline at end of file From 0c75030a44b6cc607b1058553b683a9feefade19 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 21 Mar 2024 20:35:12 +0530 Subject: [PATCH 6/6] Update price preferences --- modules/hotelreservationsystem/classes/HotelHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 2f32b0832..faecfcfa7 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -619,7 +619,7 @@ class HotelHelper 'price' => '350', 'auto_add_to_cart' => 0, 'show_at_front' => 1, - 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_BOOKING, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_DAY, 'price_addition_type' => Product::PRICE_ADDITION_TYPE_WITH_ROOM, ), array( @@ -629,7 +629,7 @@ class HotelHelper 'price' => '450', 'auto_add_to_cart' => 0, 'show_at_front' => 1, - 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_BOOKING, + 'price_calculation_method' => Product::PRICE_CALCULATION_METHOD_PER_DAY, 'price_addition_type' => Product::PRICE_ADDITION_TYPE_WITH_ROOM, ), );