Jump to content

hook into tld's output


ruswein
Go to solution Solved by DennisHermannsen,

Recommended Posts

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

dmn.jpg

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

  • Solution

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
    ];
  
});

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated