atlanticadigital Posted October 1, 2019 Share Posted October 1, 2019 Hi.I am adding a condition to the invoices so that only certain payment methods appear with customers who have not verified their mailbox.Could you tell me what is the variable that determines whether or not the customer has verified the mailbox?For example $ clientsdetails.groupid, $ clientsdetails.countryname. I need the same thing but to know if the client checked his box or not.Thank you.Diego 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 1, 2019 Share Posted October 1, 2019 Hi Diego, 57 minutes ago, atlanticadigital said: Could you tell me what is the variable that determines whether or not the customer has verified the mailbox?For example $ clientsdetails.groupid, $ clientsdetails.countryname. I need the same thing but to know if the client checked his box or not. there isn't one available for email verification - you would need a hook to check the database and return the status... though in your case, it would be a ClientAreaPageViewInvoice hook... <?php # Email Verification Hook # Written by brian! function email_verification_status_hook($vars) { $client = Menu::context("client"); $emailverified = $client->emailVerified; return array("emailverified" => $emailverified); } add_hook('ClientAreaPageViewInvoice', 1, 'email_verification_status_hook'); ?> that will return a variable to the template, {$emailverified} which will be true if they have verified their email, and false if they haven't. 1 Quote Link to comment Share on other sites More sharing options...
atlanticadigital Posted October 1, 2019 Author Share Posted October 1, 2019 Not found for my. I use in viewinvoices.tpl: .... {if $status eq "Unpaid" && $allowchangegateway} <form method="post" action="{$smarty.server.PHP_SELF}?id={$invoiceid}" class="form-inline"> {if $emailverified==false} {$gatewaydropdown|replace:'<option value="pagofacil">Pago Facil / RapiPago (Argentina)</option>':''|replace:'<option value="depositobanc">Deposito Bancario (Argentina)</option>':''|replace:'<option value="mercadopago">MercadoPago (Argentina)</option>':''|replace:'<option value="tco">Tarjeta de Credito / Debito</option>':''|replace:'<option value="mailin">Western Union</option>':''} {else} {$gatewaydropdown} {/if} ... But not found. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 1, 2019 Share Posted October 1, 2019 did you upload the hook code that I posted to /includes/hooks ? not the one I linked to, but the one above ?? if you did, then the variable should be available to the invoice page... if you add {debug} to the end of the template code and you should get a popup window when you refresh the invoice page - if $emailverified is shown in that window (as above), then the hook is passing the variable to the template; if it's not there, then the hook isn't being called. btw - you could move your entire logic from the template to the hook if you had to... {if $clientsdetails.groupid eq "6" or $clientsdetails.countryname eq "Argentina"} {$gatewaydropdown|replace:'<option value="tco">Tarjeta de Credito / Debito</option>':''|replace:'<option value="mailin">Western Union</option>':''} {else if $clientsdetails.countryname ne "Argentina"} {$gatewaydropdown|replace:'<option value="pagofacil">Pago Facil / RapiPago (Argentina)</option>':''|replace:'<option value="depositobanc">Deposito Bancario (Argentina)</option>':''|replace:'<option value="mercadopago">MercadoPago (Argentina)</option>':''} {else} {$gatewaydropdown} {/if} but let's just focus on getting $emailverified to work for now. 🙂 1 Quote Link to comment Share on other sites More sharing options...
atlanticadigital Posted October 1, 2019 Author Share Posted October 1, 2019 16 minutes ago, brian! said: did you upload the hook code that I posted to /includes/hooks ? not the one I linked to, but the one above ?? Yes, i upload the hook with ClientAreaPageViewInvoice.php name. I see "null" value in debug for $emailverified variable. 21 minutes ago, brian! said: btw - you could move your entire logic from the template to the hook if you had to... I am very interested in this. Could you help me after this issue? Thank you very much. Diego 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 1, 2019 Share Posted October 1, 2019 9 minutes ago, atlanticadigital said: I see "null" value in debug for $emailverified variable. that means the hook is working, but WHMCS doesn't think that you (as the client) are still logged in when you are viewing the invoice... possibly that is caused by the custom template, but this is working for me using Six. 50 minutes ago, atlanticadigital said: I am very interested in this. Could you help me after this issue? the equivalent hook would be along the lines of... <?php # Cart Email Verification Hook # Written by brian! function email_verification_status_hook($vars) { $client = Menu::context("client"); $gatewaydropdown = $vars['gatewaydropdown']; if ($client->groupid == "6" || $client->countryName == "Argentina") { $argentina = array("<option value=\"tco\">Tarjeta de Credito / Debito</option>","<option value=\"mailin\">Western Union</option>"); foreach ($argentina as $gateway) { $gatewaydropdown = str_replace($gateway, '', $gatewaydropdown); } return array("gatewaydropdown" => $gatewaydropdown); } elseif ($client->countryName != "Argentina") { $notargentina = array("<option value=\"pagofacil\">Pago Facil / RapiPago (Argentina)</option>","<option value=\"depositobanc\">Deposito Bancario (Argentina)</option>","<option value=\"mercadopago\">MercadoPago (Argentina)</option>"); foreach ($notargentina as $gateway) { $gatewaydropdown = str_replace($gateway, '', $gatewaydropdown); } return array("gatewaydropdown" => $gatewaydropdown); } } add_hook("ClientAreaPageViewInvoice", 1, 'email_verification_status_hook'); ?> you could add a third condition to see if their email address has been verified, but one of those first two conditions will always be true - either the client is from Argentina or they are not, so a third condition would never be checked. 1 Quote Link to comment Share on other sites More sharing options...
atlanticadigital Posted October 1, 2019 Author Share Posted October 1, 2019 Thank you very much Brian. 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.