diff --git a/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl index 0ab48c509..c5be8b1b0 100644 --- a/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl @@ -145,4 +145,27 @@ $(function() { {$orders} {/if} + + {if isset($addons) && $addons} +
+

+ {if $addons|@count == 1} + {l s='1 addon'} + {else} + {l s='%d addons' sprintf=$addons|@count} + {/if} +

+ + + {foreach $addons key=key item=addon} + + + + + {/foreach} + +
{$addon.title|escape:'htmlall':'UTF-8'}{$addon.description|escape:'htmlall':'UTF-8'}
+
+ {/if} + {/if} diff --git a/controllers/admin/AdminSearchController.php b/controllers/admin/AdminSearchController.php index 9a70c88cc..9cd2d9899 100644 --- a/controllers/admin/AdminSearchController.php +++ b/controllers/admin/AdminSearchController.php @@ -26,7 +26,6 @@ class AdminSearchControllerCore extends AdminController { - public function __construct() { $this->bootstrap = true; @@ -197,6 +196,15 @@ class AdminSearchControllerCore extends AdminController $module->linkto = 'index.php?tab=AdminModules&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name).'&token='.Tools::getAdminTokenLite('AdminModules'); $this->_list['modules'][] = $module; } + + $vars = http_build_query(array( + 'version' => _PS_VERSION_, + 'iso_lang' => Tools::strtolower(Context::getContext()->language->iso_code), + 'iso_code' => Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))), + 'search_query' => $this->query + )); + if (($json_content = Tools::file_get_contents('https://api.addons.prestashop.com/search.php?'.$vars)) != false) + $this->_list['addons'] = Tools::jsonDecode($json_content, true); } /** @@ -408,6 +416,8 @@ class AdminSearchControllerCore extends AdminController if (isset($this->_list['modules']) && count($this->_list['modules'])) $this->tpl_view_vars['modules'] = $this->_list['modules']; + if (isset($this->_list['addons']) && count($this->_list['addons'])) + $this->tpl_view_vars['addons'] = $this->_list['addons']; return parent::renderView(); }