[-] FO : #PSCFV-152 - Check payment method are allowed before displaying them on the checkout page

This commit is contained in:
mDeflotte
2012-05-03 12:45:02 +00:00
parent 73c7b86451
commit b86cfebbf4
2 changed files with 16 additions and 4 deletions
+10
View File
@@ -266,9 +266,18 @@ class HookCore extends ObjectModel
// Store results per hook name
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
$list = array();
// Get all available payment module
$payment_modules = array();
foreach (Module::getPaymentModules() as $module)
$payment_modules[] = $module['name'];
if ($results)
foreach ($results as $row)
{
if ($row['hook'] == 'displayPayment' && !in_array($row['module'], $payment_modules))
continue;
$row['hook'] = strtolower($row['hook']);
if (!isset($list[$row['hook']]))
$list[$row['hook']] = array();
@@ -324,6 +333,7 @@ class HookCore extends ObjectModel
throw new PrestaShopException('Invalid id_module or hook_name');
// If no modules associated to hook_name or recompatible hook name, we stop the function
if (!$module_list = Hook::getHookModuleExecList($hook_name))
return '';