// Added Addons search

This commit is contained in:
Damien Metzger committed 2013-11-04 12:24:55 +01:00
1 parent cfeeda7d9b
commit 0451ca5c73
2 files changed
+34 -1

No files matched your search

@@ -145,4 +145,27 @@ $(function() {
{$orders} {$orders}
</div> </div>
{/if} {/if}
{if isset($addons) && $addons}
<div class="panel">
<h3>
{if $addons|@count == 1}
{l s='1 addon'}
{else}
{l s='%d addons' sprintf=$addons|@count}
{/if}
</h3>
<table class="table">
<tbody>
{foreach $addons key=key item=addon}
<tr>
<td><strong><a href="{$addon.href|escape:'htmlall':'UTF-8'}" target="_blank">{$addon.title|escape:'htmlall':'UTF-8'}</a></strong></td>
<td><a href="{$addon.href|escape:'htmlall':'UTF-8'}" target="_blank">{$addon.description|escape:'htmlall':'UTF-8'}</a></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
{/if} {/if}
+11 -1
View File
@@ -26,7 +26,6 @@
class AdminSearchControllerCore extends AdminController class AdminSearchControllerCore extends AdminController
{ {
public function __construct() public function __construct()
{ {
$this->bootstrap = true; $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'); $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; $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'])) if (isset($this->_list['modules']) && count($this->_list['modules']))
$this->tpl_view_vars['modules'] = $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(); return parent::renderView();
} }