Jump to content
Sign in to follow this  
FrenchMarie

Viewing Extensions

Recommended Posts

Good morning all,

I come to you today because I want to have the categories and domain extensions on a personalized page.

I took the elements of the domainregister.tpl file, but unable to load the list of domain categories and the list of extensions.

A big thank you to you in advance for any response that may put us on the path

Share this post


Link to post
Share on other sites
On 28/10/2020 at 11:56, FrenchMarie said:

I took the elements of the domainregister.tpl file, but unable to load the list of domain categories and the list of extensions.

that's because the template only contains the code required to display the variables that are passed to it by WHMCS... if you just copied the code to a new page it wouldn't work because the variables will be missing.

On 28/10/2020 at 11:56, FrenchMarie said:

A big thank you to you in advance for any response that may put us on the path

to get the pricing array (or similar) used in the domainregister page available to your page, you could use the GetTLDPricing API function inside a hook.

if you just want a list of categories / TLDs, then perhaps the thread below will help...

... and don't forget there is a separate domain pricing page available @ /domain/pricing that will show the TLD pricing, including the first category a TLD is within...

Ag6eVPS.png

Share this post


Link to post
Share on other sites

Hello

Many thanks for your feedback, before I use the following code in the page php file and it will work perfectly.

$currencyid = $whmcs->get_req_var('currency');
if (!$currencyid) {
    $currencyid = $whmcs->get_req_var('currencyid');
}
if (!is_numeric($currencyid)) {
    $currency = array();
} else {
    $currency = getCurrency('', $currencyid);
}

if (!$currency || !is_array($currency) || !isset($currency['id'])) {
    $currency = getCurrency();
}
$currencyid = $currency['id'];

$categories = array();
$tldcategories = DB::table('tbltld_category_pivot as p')
    ->join('tbltld_categories as c', 'c.id', '=', 'p.category_id')
    ->join('tbltlds as t', 't.id', '=', 'p.tld_id')
    ->join('tbldomainpricing as d', DB::raw("binary d.extension"), '=', DB::raw("binary CONCAT('.', t.tld)"))
    ->orderBy('c.is_primary', 'desc')
    ->orderBy('c.display_order', 'asc')
    ->orderBy('t.tld', 'asc')
    ->select(['c.id', 'c.category', 't.tld'])
    ->get();
foreach ($tldcategories as $category) {
    if (!isset($categories[$category->id])) {
        $cat = new stdClass();
        $cat->id = $category->id;
        $cat->category = $category->category;
        $cat->topLevelDomains = array();
        $categories[$category->id] = $cat;
    }
    $categories[$category->id]->topLevelDomains[] = $category->tld;
}

$tldpricelist = DB::table('tbldomainpricing as d')
    ->join('tblpricing as p', 'p.relid', '=', 'd.id')
    ->where('p.currency', '=', $currencyid)
    ->whereIn('p.type', ['domainregister', 'domaintransfer', 'domainrenew'])
    ->orderBy('d.order')
    ->select(['d.extension as tld', 'd.group',
        DB::raw("SUM(IF(type='domainregister', msetupfee, NULL)) AS register"),
        DB::raw("SUM(IF(type='domaintransfer', msetupfee, NULL)) AS transfer"),
        DB::raw("SUM(IF(type='domainrenew', msetupfee, NULL)) AS renew")])
    ->groupBy('d.extension')
    ->get();

$tldpricing = array();
foreach ($tldpricelist as $tld) {
    $tldpricing[substr($tld->tld, 1)] = $tld;
}

$ca->setTemplate('domain-name');
$ca->assign('tldcategories', $categories);
$ca->assign('tldpricing', $tldpricing);
$ca->assign('tldpricelist', $tldpricelist);
$ca->assign('currency', $currency);



Since the update I have the error:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sitename.tbltld_category_pivot' doesn't exist in /home/sitename/public_html/vendor/illuminate/database/Connection.php:331
Stack trace:
#0 /home/sitename/public_html/vendor/illuminate/database/Connection.php(331): PDO->prepare('select `c`.`id`...')
#1 /home/sitename/public_html/vendor/illuminate/database/Connection.php(664): Illuminate\Database\Connection->Illuminate\Database\{closure}('select `c`.`id`...', Array)
#2 /home/sitename/public_html/vendor/illuminate/database/Connection.php(631): Illuminate\Database\Connection->runQueryCallback('select `c`.`id`...', Array, Object(Closure))
#3 /home/sitename/public_html/vendor/illuminate/database/Connection.php(339): Illuminate\Database\Connection->run('select `c`.`id`...', Array, Object(Closure))
#4 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2202): Illuminate\Database\Connection->select('select `c`.`id`...', Array, true)
#5 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2190): Illuminate\Database\Query\Builder->runSelect()
#6 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2685): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2191): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#8 /home/sitename/public_html/domain-name.php(42): Illuminate\Database\Query\Builder->get()
#9 {main}
Next Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'clubhost_v7.tbltld_category_pivot' doesn't exist (SQL: select `c`.`id`, `c`.`category`, `t`.`tld` from `tbltld_category_pivot` as `p` inner join `tbltld_categories` as `c` on `c`.`id` = `p`.`category_id` inner join `tbltlds` as `t` on `t`.`id` = `p`.`tld_id` inner join `tbldomainpricing` as `d` on binary d.extension = binary CONCAT('.', t.tld) order by `c`.`is_primary` desc, `c`.`display_order` asc, `t`.`tld` asc) in /home/sitename/public_html/vendor/illuminate/database/Connection.php:671
Stack trace:
#0 /home/sitename/public_html/vendor/illuminate/database/Connection.php(631): Illuminate\Database\Connection->runQueryCallback('select `c`.`id`...', Array, Object(Closure))
#1 /home/sitename/public_html/vendor/illuminate/database/Connection.php(339): Illuminate\Database\Connection->run('select `c`.`id`...', Array, Object(Closure))
#2 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2202): Illuminate\Database\Connection->select('select `c`.`id`...', Array, true)
#3 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2190): Illuminate\Database\Query\Builder->runSelect()
#4 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2685): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /home/sitename/public_html/vendor/illuminate/database/Query/Builder.php(2191): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /home/sitename/public_html/domain-name.php(42): Illuminate\Database\Query\Builder->get()
#7 {main}


cordially

Share this post


Link to post
Share on other sites
20 hours ago, FrenchMarie said:

Many thanks for your feedback, before I use the following code in the page php file and it will work perfectly.

I assume you were using a version before v7.10  when this code worked ? because when you update to v7.10 or later, the three tbltld database tables are removed - that's why your queries are causing errors as they are referencing tables that no longer exist in the database.

Share this post


Link to post
Share on other sites

Hello and thank you for your feedback,

Yes exactly, a real shame because the result was impeccable.

Too bad that nobody can rewrite this part of the code in order to be able to exploit it again.

cordially

Share this post


Link to post
Share on other sites
On 04/11/2020 at 15:04, FrenchMarie said:

Too bad that nobody can rewrite this part of the code in order to be able to exploit it again.

it occurs to me that there is another way if you want to go down that road of continuing to use the hook - recreate the 3 tbltld database tables that it refers to. 💡

the sql queries that creates the tables, and fills them with data might still exist in your /resources/sql/install directory...

TwfgJEF.png

if they don't, then they would exist in a v7.9.2 (or earlier) zip file.

I think i'd be tempted to change the table names, just in case a future updater doesn't like them being there and removes them again - it shouldn't remove renamed tables... and then adjust your hook to use the renamed tables.

as long as you're not updating categories.json often, then I wouldn't have thought there would be too many differences between the tables and the json file... and if you are updating categories, then just remember to update them in the json and edit the database accordingly at the same time.

Share this post


Link to post
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.

Sign in to follow this  

  • Similar Content

    • By Hosting!
      Successfully connected Enom domain provider and WHMCS and activated but it does not seem to be working. What could be the reason for this and how can this problem be solved?

    • By andyhughes73
      I have bought a domain on behalf of a customer, through my hosting provider. I would like to attribute this domain to my customer's WHMCS account for invoicing and renewal purposes but I'm not entirely sure how. The WHMCS system is also hosted on the same hosting provider. Not sure that's relevant, probably not.
      I have done a search to see if there are other posts but I've drawn a blank and I can't find it in the manual, or maybe I'm misunderstanding how to explain it.
      Any help would be much appreciated.
       
    • By immu
      Hey Team,
      I have a custom form where user inputs his domain name and tld, post submit - I want to catch the query string parameters, execute search (for availability) and show results accordingly.
      in WHMCS I see lot of 'clientareadomain...' tpl templates, I'm not sure which tpl points to ' register new domain page' in client area.
      can you guys help me here, really stuck
       
      Thanks in Advance.
      Best Regards,
      Immu
    • By sly2000
      Colleagues, in general, the question is this: buying domains does not work (neither automatic nor manual) (WHMCS version - 7.10.1)
      In the logs he writes the following:
      23/09/2020 22:17 Domain Registration Failed - Domain ID: 8 - Domain: primer-dom.com - Error: Operation can not completed successfully!<br />Reseller not found! Although the reseller is clearly indicated in the settings! If you change the reseller (domain registrar) to any other, the effect is the same ...
      Any thoughts on this? What could be the problem?

       
    • By ModulesGarden
      Buckle up! WHMCS V8.0 has entered the Release Candidate stage, and we all know what that means - the stable release is only a matter of time now!

      What makes this news even more exciting is that we are more than halfway through labeling our WHMCS products as finely compatible with WHMCS V8.0. More powerful updates are headed your way! Meanwhile, check which modules have been confirmed to work well in the new environment most recently:
      Domain Allocator For WHMCS - v1.0.8 Domain Orders Extended For WHMCS - v3.5.3 Hetzner VPS For WHMCS - v1.3.1 Office 365 For WHMCS - v2.2.2 Payment Gateway Charges For WHMCS - v2.1.7 Product Auto Upgrade For WHMCS - v2.0.7 Time & Task Manager For WHMCS - v1.4.11 SolusVM Extended VPS For WHMCS - v1.9.3
      Cast a quick look at the full record!



      Need Custom Software Development For Your Business?
      Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
  • 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