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
deleted file mode 100644
index 02f49cba0..000000000
--- a/admin/themes/default/template/controllers/cart_rules/helpers/list/_hotel_names_column.tpl
+++ /dev/null
@@ -1,31 +0,0 @@
-{**
-* 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
-*}
-
-{if $hotel_names_first}
- {$hotel_names_first|escape:'html':'UTF-8'}
- {if $hotel_names_remaining}
- +{$hotel_names_remaining|@count}
- {/if}
-{else}
- --
-{/if}
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
index db4f27a57..d0c2ab5ba 100644
--- 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
@@ -20,13 +20,22 @@
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
-
+{if $hotel_names_first}
+ {$hotel_names_first|escape:'html':'UTF-8'}
+ {if $hotel_names_remaining}
+ {capture name='hotel_names_tooltip'}
+
+ {/capture}
+ +{$hotel_names_remaining|@count}
+ {$smarty.capture.hotel_names_tooltip}
+ {/if}
+{else}
+ --
+{/if}
diff --git a/controllers/admin/AdminCartRulesController.php b/controllers/admin/AdminCartRulesController.php
index 52edd0525..bcc163248 100644
--- a/controllers/admin/AdminCartRulesController.php
+++ b/controllers/admin/AdminCartRulesController.php
@@ -89,14 +89,13 @@ 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' => $remaining,
- 'hotel_names_remaining_json' => htmlspecialchars(json_encode($remaining)),
+ 'hotel_names_first' => !empty($hotels) ? $hotels[0] : null,
+ 'hotel_names_remaining' => count($hotels) > 1 ? array_slice($hotels, 1) : array(),
));
+
return $this->context->smarty->fetch(
- 'controllers/cart_rules/helpers/list/_hotel_names_column.tpl'
+ 'controllers/cart_rules/helpers/list/_hotel_names_tooltip.tpl'
);
}
@@ -280,19 +279,9 @@ class AdminCartRulesControllerCore extends AdminController
);
$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
deleted file mode 100644
index 0bbdfe19d..000000000
--- a/js/admin/cart_rules_hotel_tooltip.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* 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();
-});