diff --git a/admin/themes/default/template/recomended-banner.tpl b/admin/themes/default/template/recomended-banner.tpl
index 343cd5899..70519f354 100644
--- a/admin/themes/default/template/recomended-banner.tpl
+++ b/admin/themes/default/template/recomended-banner.tpl
@@ -17,7 +17,7 @@
* @license https://store.webkul.com/license.html
*}
-
+
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index 55b42821b..f95c48be7 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -3900,6 +3900,29 @@ class AdminControllerCore extends Controller
die($popup_content);
}
+ public function ajaxProcessGetRecommendationContent()
+ {
+ $response = array('success' => false);
+ if (isset($this->context->cookie->{$this->controller_name.'_closed'}) && $this->context->cookie->{$this->controller_name.'_closed'}) {
+ $response['success'] = true;
+ } else {
+ if (method_exists($this, 'getRecommendationContent')) {
+ if ($content = $this->getRecommendationContent()) {
+ $response['success'] = true;
+ $response['content'] = $content;
+ }
+ }
+ }
+ $this->ajaxDie(json_encode($response));
+ }
+
+ public function ajaxProcessRecommendationClosed()
+ {
+ $this->context->cookie->{Tools::getValue('tab').'_closed'} = true;
+ $response = array('success' => true);
+ $this->ajaxDie(json_encode($response));
+ }
+
/**
* Enable multiple items
*
diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php
index 8f54e0166..157b49252 100644
--- a/controllers/admin/AdminDashboardController.php
+++ b/controllers/admin/AdminDashboardController.php
@@ -494,16 +494,6 @@ class AdminDashboardControllerCore extends AdminController
die(json_encode($return));
}
- public function ajaxProcessGetRecommendationContent()
- {
- $response = array('success' => false);
- if ($content = $this->getRecommendationContent()) {
- $response['success'] = true;
- $response['content'] = $content;
- }
- $this->ajaxDie(json_encode($response));
- }
-
public function getRecommendationContent()
{
if (!Tools::isFresh(self::DASHBOARD_RECOMMENDATION_CONTENT, _TIME_1_DAY_)) {
diff --git a/controllers/admin/AdminModulesCatalogController.php b/controllers/admin/AdminModulesCatalogController.php
index 9f1abd920..a53454b62 100644
--- a/controllers/admin/AdminModulesCatalogController.php
+++ b/controllers/admin/AdminModulesCatalogController.php
@@ -290,16 +290,6 @@ class AdminModulesCatalogControllerCore extends AdminController
}
- public function ajaxProcessGetRecommendationContent()
- {
- $response = array('success' => false);
- if ($content = $this->getRecommendationContent()) {
- $response['success'] = true;
- $response['content'] = $content;
- }
- $this->ajaxDie(json_encode($response));
- }
-
public function ajaxProcessSetSorting()
{
$this->setSorting(Tools::getValue('module_sorting'), Tools::getValue('theme_sorting'));
diff --git a/js/admin.js b/js/admin.js
index 62da0859c..15aa14d64 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -1610,9 +1610,18 @@ function loadRecommendation()
token: token
},
success: function(res) {
- $('#recommendation-wrapper-skeleton').fadeOut('slow').hide();
- if (res.success) {
- $('#recommendation-wrapper').html(res.content).fadeIn('slow');
+ if (res.success && res.content.trim()) {
+ $('#recommendation-wrapper-skeleton').fadeIn('slow');
+ $('#recommendation-wrapper').html(res.content);
+ let images = $('#recommendation-wrapper img');
+ let loaded = 0;
+ let total = $(images).length;
+ $(images).on('load', function() {
+ if (++loaded === total) {
+ $('#recommendation-wrapper-skeleton').fadeOut('slow').hide();
+ $('#recommendation-wrapper').fadeIn();
+ }
+ });
}
},
error: function(res) {
@@ -1620,3 +1629,20 @@ function loadRecommendation()
}
});
}
+
+function closeRecommendation()
+{
+ $('#recommendation-wrapper').fadeOut('slow');
+ $.ajax({
+ type: 'POST',
+ url: 'index.php',
+ async: true,
+ dataType: 'JSON',
+ data: {
+ action: 'recommendationClosed',
+ tab: help_class_name,
+ ajax: 1,
+ token: token
+ }
+ });
+}