ruswein Posted August 2, 2023 Share Posted August 2, 2023 Hello all, I hope you are all well. I need manipulate output for tld's table generated by cart.php?a=add&domain=register Reason: my domain registrar charges a setup fee for some TLD's. I edited the template files and added additional column for that (see attached file). What I need now is to know how I can fill this table with values. Values stored allready in db (writing while tld sync). Can I hook into process and add setup fees bevore it going to display? Thx in advance 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted August 4, 2023 Share Posted August 4, 2023 I think you're overthinking the issue. You already have three fields: Registration, Transfer and Renewal. The registration field could simply include the setup fee. Let's say your TLD costs 15€ to register, transfer and renew but also has a 2€ setup fee. Simply set the registration fee to 17€. 0 Quote Link to comment Share on other sites More sharing options...
ruswein Posted August 4, 2023 Author Share Posted August 4, 2023 Hi Dennis, thank you for you reply. Currently it is solved exactly like this. But it is not very elegant and not the only problem. Besides the setup fee here, there are also update costs. So I have to reorganize the price table completely. 0 Quote Link to comment Share on other sites More sharing options...
Solution DennisHermannsen Posted August 5, 2023 Solution Share Posted August 5, 2023 You could use the ClientAreaPageCart hook event to add additional variables that can be used in the cart templates. <?php use WHMCS\Database\Capsule; add_hook('ClientAreaPageCart', 1, function($vars) { //replace below with actual call to the database $prices = Capsule::table('table') ->where('x', 'y') ->get(); return [ 'variable1' => $prices->something, 'variable2' => $prices->somethingElse ]; }); 0 Quote Link to comment Share on other sites More sharing options...
ruswein Posted August 7, 2023 Author Share Posted August 7, 2023 Hi Dennis, thank you very much. I will try it and report. 0 Quote Link to comment Share on other sites More sharing options...
ruswein Posted August 8, 2023 Author Share Posted August 8, 2023 Nice, it works. Thank you! 0 Quote Link to comment Share on other sites More sharing options...
ruswein Posted August 8, 2023 Author Share Posted August 8, 2023 Looks like you can even do it directly from the registrar module. https://developers.whmcs.com/domain-registrars/extending-further/ I could send the values to domainregister.tpl with a custom function? Does anyone know this or has possibly already tested? 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted August 8, 2023 Share Posted August 8, 2023 No. You would only be able to use the same hook (but place it inside /modules/registrars/yourRegistrar/hooks.php instead of /includes/hooks/yourHook.php). If you create a custom function (let's say yourRegistrar_customFunction()), it is only available after the module has been assigned to the domain (after ordering), and it will only be available from the domain details page. 0 Quote Link to comment Share on other sites More sharing options...
ruswein Posted August 8, 2023 Author Share Posted August 8, 2023 ok got it. Thx. 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.