Jump to content

Import all TLD prices to template page.


inTempo

Recommended Posts

Hi all,

I use a template ontop of my WHMCS, and in that template i need to use like this

{$tldPricing["com"]["register"].1}

This works on my front page, but not a subpage.

I tried to do a curl as help file says, but it never worked.

Isnt there a easier way?

Thanks.

Link to comment
Share on other sites

14 hours ago, inTempo said:

Isnt there a easier way?

using the API in a hook?

<?php

# TLD Pricing on Custom Page Hook
# Written by brian!

function tld_pricing_on_custom_page_hook($vars) {
	
	if ($vars['filename'] == "subpage" && empty($vars['tldPricing'])) {
		$results = localAPI('GetTLDPricing', array('currencyid' => '1',));
		return array("tldPricing" => $results['pricing']);
	}
}
add_hook('ClientAreaPage', 1, 'tld_pricing_on_custom_page_hook');

just rename "subpage" to whatever your subpage filename is (without the. .php) and select your preferred currency ID value - the returned prices won't be currency formatted (e.g no prefix/suffix), but I assume you will already know what they are and so can be added manually, or you could loop through the results array and add them in the hook (if you had to!).

using Data Feeds would be an option - but if you prefer to stick with the array format used elsewhere, then the API may be your best bet.

Link to comment
Share on other sites

17 hours ago, inTempo said:

Thanks, did some changes so it adapts to currently selected currency, but i get a 403 when i try to post, but it works so thanks Brian 🙂

trying to use $ _ GET in the hook? for some bizarre reason, we can't post that anymore. 🙄

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