Nyan Posted November 11, 2016 Share Posted November 11, 2016 I set 1,234 as Currencies Format. Please look at ad_amount.png and apply_credit.png. Amount to Add is 0.00. Apply Credit is 500.00. I wish the display of 0 and 500. If there is a method using hooks, please tell me how to resolve using hooks. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 11, 2016 Share Posted November 11, 2016 you could do it in the template by just changing... clientareaaddfunds.tpl <input type="text" name="amount" id="amount" value="{$amount}" class="form-control" required /> to... <input type="text" name="amount" id="amount" value="{$amount|floor}" class="form-control" required /> viewinvoice.tpl <input type="text" name="creditamount" value="{$creditamount}" class="form-control" /> to... <input type="text" name="creditamount" value="{$creditamount|floor}" class="form-control" /> that should effectively round down the number. if you wanted to use hooks, then you'd get these variables from the template, perform your calculation on them (e.g floor, round, string/number format etc) and then send the result back to the template - you'd probably use the ClientAreaPageAddFunds and ClientAreaPageViewInvoice action hooks. 0 Quote Link to comment Share on other sites More sharing options...
Nyan Posted November 11, 2016 Author Share Posted November 11, 2016 Thank you brian! I want to use hooks. Based on your advice, I set the following code in /includes/hooks/. I am not confident, because I am a beginner. Is this a problem? Please tell me correct method. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPageAddFunds', 1, function($vars) { $amount = $vars['amount']; return array( "amount" => floor($amount) ); } ); add_hook('ClientAreaPageViewInvoice', 1, function($vars) { $creditamount = $vars['creditamount']; return array( "creditamount" => floor($creditamount) ); } ); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 11, 2016 Share Posted November 11, 2016 it should work - personally, i'd have shortened it as below, but either should be ok... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPageAddFunds', 1, function($vars) { $amount = floor($vars['amount']); return array("amount" => $amount); } ); add_hook('ClientAreaPageViewInvoice', 1, function($vars) { $creditamount = floor($vars['creditamount']); return array("creditamount" => $creditamount); } ); 0 Quote Link to comment Share on other sites More sharing options...
Nyan Posted November 11, 2016 Author Share Posted November 11, 2016 Thank you brian! I can change code with confidence. 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.