diff --git a/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_column.tpl b/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_column.tpl
index ba0b42652..02f49cba0 100644
--- a/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_column.tpl
+++ b/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_column.tpl
@@ -23,15 +23,8 @@
{if $hotel_names_first}
{$hotel_names_first|escape:'html':'UTF-8'}
{if $hotel_names_remaining}
- {assign var='tooltipLines' value=''}
- {foreach from=$hotel_names_remaining item='hotel' key='index'}
- {assign var='tooltipLines' value="{$tooltipLines}{if $index > 0}
{/if}{$hotel|escape:'html':'UTF-8'}"}
- {/foreach}
- +{$hotel_names_remaining|@count}
+ +{$hotel_names_remaining|@count}
{/if}
{else}
--
diff --git a/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_tooltip.tpl b/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_tooltip.tpl
new file mode 100644
index 000000000..db4f27a57
--- /dev/null
+++ b/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_tooltip.tpl
@@ -0,0 +1,32 @@
+{**
+* NOTICE OF LICENSE
+*
+* This source file is subject to the Open Software License version 3.0
+* that is bundled with this package in the file LICENSE.md
+* It is also available through the world-wide-web at this URL:
+* https://opensource.org/license/osl-3-0-php
+* If you did not receive a copy of the license and are unable to
+* obtain it through the world-wide-web, please send an email
+* to support@qloapps.com so we can send you a copy immediately.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to a newer
+* versions in the future. If you wish to customize this module for your needs
+* please refer to https://store.webkul.com/customisation-guidelines for more information.
+*
+* @author Webkul IN
+* @copyright Since 2010 Webkul
+* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
+*}
+
+
diff --git a/controllers/admin/AdminCartRulesController.php b/controllers/admin/AdminCartRulesController.php
index 111114869..52edd0525 100644
--- a/controllers/admin/AdminCartRulesController.php
+++ b/controllers/admin/AdminCartRulesController.php
@@ -89,9 +89,11 @@ class AdminCartRulesControllerCore extends AdminController
public function formatHotelNames($hotelNames, $row)
{
$hotels = !empty($hotelNames) ? explode('|||', $hotelNames) : array();
+ $remaining = count($hotels) > 1 ? array_slice($hotels, 1) : array();
$this->context->smarty->assign(array(
- 'hotel_names_first' => !empty($hotels) ? $hotels[0] : null,
- 'hotel_names_remaining' => count($hotels) > 1 ? array_slice($hotels, 1) : array(),
+ 'hotel_names_first' => !empty($hotels) ? $hotels[0] : null,
+ 'hotel_names_remaining' => $remaining,
+ 'hotel_names_remaining_json' => htmlspecialchars(json_encode($remaining)),
));
return $this->context->smarty->fetch(
'controllers/cart_rules/helpers/list/_hotel_names_column.tpl'
@@ -276,10 +278,21 @@ class AdminCartRulesControllerCore extends AdminController
'room_rmv_txt' => $this->l('Unselect below room types'),
)
);
+ $this->addJqueryUI('ui.tooltip', 'base', true);
$this->addJS(_PS_JS_DIR_.'admin/cart-rules.js');
+ $this->addJS(_PS_JS_DIR_.'admin/cart_rules_hotel_tooltip.js');
$this->addJqueryPlugin(array('typewatch', 'fancybox', 'autocomplete'));
}
+ public function renderList()
+ {
+ $this->content .= $this->context->smarty->fetch(
+ 'controllers/cart_rules/helpers/list/_hotel_names_tooltip.tpl'
+ );
+
+ return parent::renderList();
+ }
+
public function initPageHeaderToolbar()
{
if (empty($this->display)) {
diff --git a/js/admin/cart_rules_hotel_tooltip.js b/js/admin/cart_rules_hotel_tooltip.js
new file mode 100644
index 000000000..0bbdfe19d
--- /dev/null
+++ b/js/admin/cart_rules_hotel_tooltip.js
@@ -0,0 +1,61 @@
+/*
+* NOTICE OF LICENSE
+*
+* This source file is subject to the Open Software License version 3.0
+* that is bundled with this package in the file LICENSE.md
+* It is also available through the world-wide-web at this URL:
+* https://opensource.org/license/osl-3-0-php
+* If you did not receive a copy of the license and are unable to
+* obtain it through the world-wide-web, please send an email
+* to support@qloapps.com so we can send you a copy immediately.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to a newer
+* versions in the future. If you wish to customize this module for your needs
+* please refer to https://store.webkul.com/customisation-guidelines for more information.
+*
+* @author Webkul IN
+* @copyright Since 2010 Webkul
+* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
+*/
+
+$(document).ready(function () {
+ if (typeof window.initHotelNamesTooltips === 'undefined') {
+ window.initHotelNamesTooltips = function () {
+ if (typeof $.fn.tooltip === 'undefined' || typeof $.ui === 'undefined' || typeof $.ui.tooltip === 'undefined') {
+ return;
+ }
+ $('.qlo-hotel-names-badge').each(function () {
+ if ($(this).data('ui-tooltip')) {
+ return;
+ }
+ $(this).tooltip({
+ items: '.qlo-hotel-names-badge',
+ content: function () {
+ var hotels = $(this).data('hotel-names');
+ if (!hotels || !hotels.length) {
+ return '';
+ }
+ var rows = $.map(hotels, function (name) {
+ return '' + $('
').text(name).html() + '
';
+ }).join('');
+ $('#qlo-hotel-names-tooltip .qlo-hotel-names-list').html(rows);
+ return $('#qlo-hotel-names-tooltip').html();
+ },
+ close: function (event, ui) {
+ ui.tooltip.hover(function () {
+ $(this).stop(true).fadeTo(300, 1);
+ },
+ function () {
+ $(this).fadeOut('300', function () {
+ $(this).remove();
+ });
+ });
+ }
+ });
+ });
+ };
+ }
+ window.initHotelNamesTooltips();
+});