[-] PROJECT : You can now execute hook in the tpl
This commit is contained in:
@@ -175,10 +175,17 @@ class HookCore extends ObjectModel
|
||||
if ((!empty($id_module) && !Validate::isUnsignedId($id_module)) || !Validate::isHookName($hook_name))
|
||||
die(Tools::displayError());
|
||||
|
||||
if (!Hook::getIdByName($hook_name))
|
||||
return false;
|
||||
|
||||
self::preloadHookAlias();
|
||||
$hook_name_retro = strtolower($hook_name);
|
||||
if (isset(self::$preloadHookAlias[$hook_name]))
|
||||
$hook_name = self::$preloadHookAlias[$hook_name];
|
||||
if (strtolower($hook_name) == strtolower($hook_name_retro))
|
||||
foreach (self::$preloadHookAlias as $alias => $new)
|
||||
if (strtolower($hook_name_retro) == strtolower($new))
|
||||
$hook_name_retro = $alias;
|
||||
|
||||
$live_edit = false;
|
||||
if (!isset($hookArgs['cookie']) || !$hookArgs['cookie'])
|
||||
|
||||
@@ -58,6 +58,7 @@ smartyRegisterFunction($smarty, 'function', 'm', 'smartyMaxWords'); // unused
|
||||
smartyRegisterFunction($smarty, 'function', 'p', 'smartyShowObject'); // Debug only
|
||||
smartyRegisterFunction($smarty, 'function', 'd', 'smartyDieObject'); // Debug only
|
||||
smartyRegisterFunction($smarty, 'function', 'l', 'smartyTranslate');
|
||||
smartyRegisterFunction($smarty, 'function', 'hook', 'smartyHook');
|
||||
|
||||
smartyRegisterFunction($smarty, 'function', 'dateFormat', array('Tools', 'dateFormat'));
|
||||
smartyRegisterFunction($smarty, 'function', 'convertPrice', array('Product', 'convertPrice'));
|
||||
@@ -143,3 +144,9 @@ function smartyRegisterFunction($smarty, $type, $function, $params)
|
||||
return false;
|
||||
$smarty->registerPlugin($type, $function, $params);
|
||||
}
|
||||
|
||||
function smartyHook($params, &$smarty)
|
||||
{
|
||||
if (isset($params['h']) && !empty($params['h']))
|
||||
return Hook::exec($params['h']);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<module>
|
||||
<name>carriercompare</name>
|
||||
<displayName><![CDATA[Shipping Estimation]]></displayName>
|
||||
<version><![CDATA[1.1]]></version>
|
||||
<version><![CDATA[1.2]]></version>
|
||||
<description><![CDATA[Module to compare carrier possibilities before using the checkout process]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[shipping_logistics]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -7,7 +7,6 @@
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[billing_invoicing]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
Reference in New Issue
Block a user