Jump to content

Payment Carriers restrictions


Recommended Posts

Please, how to update module Payment_Carriers_restrictions from PS 1.3 for PS 1.4. I need to show only selected cariers in the order confirmation. I think that should be added one more condition here.
In file classes/module.php.

    public static function hookExecPayment()
   {
       global $cart, $cookie;
       $hookArgs = array('cookie' => $cookie, 'cart' => $cart);
       $id_customer = intval($cookie->id_customer);
       $billing = new Address(intval($cart->id_address_invoice));
       $output = '';

       $result = Db::getInstance()->ExecuteS('
       SELECT DISTINCT h.`id_hook`, m.`name`, hm.`position`
       FROM `'._DB_PREFIX_.'module_country` mc
       LEFT JOIN `'._DB_PREFIX_.'module` m ON m.`id_module` = mc.`id_module`
       INNER JOIN `'._DB_PREFIX_.'module_group` mg ON (m.`id_module` = mg.`id_module`)

   INNER JOIN `'._DB_PREFIX_.'customer_group` cg on (cg.`id_group` = mg.`id_group` AND cg.`id_customer` = '.intval($id_customer).')
       LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
       LEFT JOIN `'._DB_PREFIX_.'hook` h ON hm.`id_hook` = h.`id_hook`
       WHERE h.`name` = \'payment\'
       AND mc.id_country = '.intval($billing->id_country).'

   AND m.`active` = 1
       ORDER BY hm.`position`, m.`name` DESC');
       if ($result)
           foreach ($result AS $k => $module)
               if (($moduleInstance = Module::getInstanceByName($module['name'])) AND is_callable(array($moduleInstance, 'hookpayment')))
                   if (!$moduleInstance->currencies OR ($moduleInstance->currencies AND sizeof(Currency::checkPaymentCurrencies($moduleInstance->id))))
                       $output .= call_user_func(array($moduleInstance, 'hookpayment'), $hookArgs);
       return $output;
   }



Thanks for help.....

Link to comment
Share on other sites

×
×
  • Create New...