dewabizmedia Posted February 21, 2022 Share Posted February 21, 2022 hi @brian! please help. when viewing invoice currency usd, clients can only pay by bank transfer Thanks 0 Quote Link to comment Share on other sites More sharing options...
altomarketing Posted April 27, 2022 Share Posted April 27, 2022 On 12/27/2020 at 11:15 AM, brian! said: <?php # Remove Gateways From Add Funds Page Hook # Written by brian! function addfunds_gateway_removal($vars) { $client = Menu::context('client'); $currency = $client->currency; $gateways = $vars['gateways']; if ($currency == 1) { $validgateways = array('banktransfer'); } elseif ($currency == 2) { $validgateways = array('banktransfer'); } foreach ($gateways as $k => $item) { if (!in_array($item['sysname'],$validgateways)) { unset($gateways[$k]); } } return array("gateways" => $gateways); } add_hook("ClientAreaPageAddFunds", 1, "addfunds_gateway_removal"); So for ClientAreaPageViewInvoice , why this does not work ? <?php function gateway_pormoneda($vars) { //$client = Menu::context('client'); //$currency = $client->currency; $currency = $vars['currency']; $gateways = $vars['gateways']; if ($currency == 1) { $validgateways = array('paypalcheckout','stripe'); } elseif ($currency == 2) { $validgateways = array('directopago_cl','stripe'); } elseif ($currency == 7) { $validgateways = array('directopago_uy','stripe'); } elseif ($currency == 10) { $validgateways = array('cuentadigital'); } foreach ($gateways as $k => $item) { if (!in_array($item['sysname'],$validgateways)) { unset($gateways[$k]); } } return array("gateways" => $gateways); } add_hook("ClientAreaPageViewInvoice", 1, "gateway_pormoneda"); 0 Quote Link to comment Share on other sites More sharing options...
M. Rahman Posted June 15, 2022 Share Posted June 15, 2022 On 12/24/2020 at 3:43 AM, cswschinmay said: <?php /** * Modify Payment Gateway Options Based On Currency * @author Brian! */ function addfunds_gateway_removal($vars) { { $gateways = $vars['gateways']; $currency = $vars['currency']; if (in_array($currency['code'],array('EUR'))) { $allowed = ['stripe']; } elseif (in_array($currency['code'],array('INR'))) { $allowed = ['razorpay']; } elseif (in_array($currency['code'],array('USD'))) { $allowed = ['paypal']; } if (!empty($allowed)) { foreach ($gateways as $k => $item) { if (!in_array($item['sysname'],$allowed)) { unset($gateways[$k]); } } return array("gateways" => $gateways); } } } add_hook("ClientAreaPageCart", 1, "addfunds_gateway_removal"); add_hook("ClientAreaPageAddFunds", 1, "addfunds_gateway_removal"); Thanks for your help. This hook worked for me. But, one issue. After placing an order, on the invoice page. There is no dropdown for selecting another gateway as per the hook. 0 Quote Link to comment Share on other sites More sharing options...
M. Rahman Posted June 16, 2022 Share Posted June 16, 2022 Can anyone help me on this? 0 Quote Link to comment Share on other sites More sharing options...
M. Rahman Posted June 16, 2022 Share Posted June 16, 2022 @brian! Can you please do something about this? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted June 16, 2022 Share Posted June 16, 2022 3 hours ago, M. Rahman said: @brian! Can you please do something about this? He "retired" from here quite some time ago. He shows up every once in a while, but isn't anywhere near as active as he had been. 0 Quote Link to comment Share on other sites More sharing options...
rickymdq Posted October 9, 2023 Share Posted October 9, 2023 Hola alguien ha podido resolver porque no funciona el hook para cuando se visualizan las factura aquí dejo el que ha desarrollado brian <?php # ViewInvoice Gateway Hook # Written by brian! function hook_view_invoice_gateway($vars) { $client = $vars['clientsdetails']; $currency = $client['currency']; $gateways = $vars['gateways']; if ($currency == '1') { $allowed = ['stripe','paypal','bitpay','banktransfer']; } elseif ($currency == '3') { $allowed = ['razorpay','banktransfer']; } elseif ($currency == '6') { $allowed = ['stripe','pl_stripe_sofort','banktransfer']; } else { $gatewaylimit = 0; } if ($vars['status'] == 'Unpaid' && $vars['clientdetails']->toNumeric() = $currency) { $gatewaydropdown = $vars['gatewaydropdown']; $stripe = '<option value="stripe">Stripe</option>'; $pl_stripe_sofort = '<option value="pl_stripe_sofort">Stripe</option>'; $gd2 = str_replace($stripe, '', $gatewaydropdown) ; return array("gatewaydropdown" => $gd2); } } add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_gateway'); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.