lechowski / 13.11.2021

Disable modules by currency

Sometimes you need to hide a module for some currencies. You only need the currency ID and change the _construct controller in the module php file. FOr example, for the ps_bankwire module you need to add this code in the function __construct i nthe file ps_bankwire.php file

 

public function __construct()

{

        $current_context = Context::getContext();

        if($current_context->controller->controller_type == 'front' &&  $this->context->currency->id == 2){

            exit;

        }

}

in this example, we hide the module for currency ID 2, and only in front office  with this line:

$current_context->controller->controller_type == 'front'