Jump to content

Recommended Posts

Hi Guys,

While coding the registrar module, TLD & Pricing Sync function, the setYears method confused me.

Can anybody show me any reference on how the array structure should be arranged?

Recently I tried to pass the array as follow to setYears.

Array
(
  [1] => 7.5
  [2] => 15
  [3] => 22.5
)

It ended up show in the import screen as 7.5 years as follow screen captured, with no years pricing tap also.image.thumb.png.28b85c5b30fa33a47d24206286301d67.png

 

Tried with the setMinYears(1) and setMaxYears(10), but no use, the imported TLD is only configured 1st year price tier.

image.thumb.png.930a235ab00ab2d4f04015af99d6431d.png

 

TQ.

Best Regards,
Nelson

Share this post


Link to post
Share on other sites

Tried to test out the code, and found the sample given is truly sucks...

Here's the snap of code I try, and it is now successfully import with multi years price, in year multiplier basis on subscription price assigned.

$item = (new ImportItem)
            ->setExtension($extension['tld'])
            ->setYears(array(1,2,3,4,5,6,7,8,9,10))
            ->setMinYears((int)$extension['minPeriod'])
            ->setMaxYears((int)$extension['maxPeriod'])
            ->setYearsStep(1)
            ->setRegisterPrice($extension['registrationPrice'])
            ->setRenewPrice($extension['renewalPrice'])
            ->setTransferPrice($extension['transferPrice'])
            ->setRedemptionFeePrice($extension['redemptionFee'])
            ->setCurrency(strval($extension['currencyCode']));

 

Share this post


Link to post
Share on other sites
On 4/27/2021 at 9:58 PM, PapaKai said:

https://developers.whmcs.com/domain-registrars/tld-pricing-sync/

 

setYears has to be used in place of setMinYears, setMaxYears and setYearsStep methods and not everything combined. Use either setYears OR (setMinYears, setMaxYears and setYearsStep).

What it told in the developer page, is just says the setYears is an array.  Maybe you can provide some details on how the setYears array should form?

Tried a lot of way to get this work, but yet failed.

Thanks in advanced.

 

Share this post


Link to post
Share on other sites

WHMCS is dealing with integers regarding registration periods / terms. So, I guess, it is an array of integers. e.g. "$terms = [1,2,3,4,5,6,7,8,9,10];" This of course differs from TLD to TLD.
In your initial thread comment, you said:

Array
(
  [1] => 7.5
  [2] => 15
  [3] => 22.5
)

There are some issues with that:
a) the index does not start with 0
b) the values at index 1 and 3 do not represent integers

Usually registration periods are full years, I just remember .de offering a monthly term in addition and .nl a quarterly term in addition - but that's not supported by WHMCS. Just care about providing a list of ints, voilà.
 

Share this post


Link to post
Share on other sites
2 hours ago, PapaKai said:

WHMCS is dealing with integers regarding registration periods / terms. So, I guess, it is an array of integers. e.g. "$terms = [1,2,3,4,5,6,7,8,9,10];" This of course differs from TLD to TLD.
In your initial thread comment, you said:


Array
(
  [1] => 7.5
  [2] => 15
  [3] => 22.5
)

There are some issues with that:
a) the index does not start with 0
b) the values at index 1 and 3 do not represent integers

Usually registration periods are full years, I just remember .de offering a monthly term in addition and .nl a quarterly term in addition - but that's not supported by WHMCS. Just care about providing a list of ints, voilà.
 

Actually this is what confused me:

If the index should start with 0, and the value equal to "year", where to define the price?

Share this post


Link to post
Share on other sites

Prices are automatically calculated by WHMCS: 

Quote

termprice = term * registerPrice

This is very strict and does not allow for importing special prices.

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.


  • Similar Content

    • By Nelson Neoh
      Hi there.
      I noticed there are sometimes we need to put some additional information in the Contact Information form (/clientarea.php?action=domaincontacts&domainid=123), to fulfill certain TLDs Registry requirements, especially on ccTLDs.  For example: Company Registration number and etc.
      There is always a quick fix to hardcode in the template but for sure it is not the appropriate way to do so.
      Any advice I can inject those required custom fields based on selected TLDs, when client accessing respective domain contact?
      Thanks in advanced.
      Regards,
      Nelson
    • By PapaKai
      Dear WHMCS Community,
      As we, up to now, did not use this community to promote us and our modules, I'll give it a try.
      To introduce myself: I am the Middleware Department Lead at HEXONET GmbH in Germany. My team is responsible for third-party integrations (WHMCS, Blesta, ...) and for providing tools for custom integrations.
      With HEXONET (located in Germany and Canada) you can easily resell and manage domains. We do our best to support our customers and to improve/extend in direction of specific customer requests.
      We are offering all our modules for free and we have no plans to change this. We have:
      The HEXONET registrar module that is shipped with WHMCS (get in touch with us to get updates as that version is for behind in point of features). Supporting all known WHMCS Domain Registrar Features e.g. IRTP (contact verification), TLD & Pricing Sync, Premium Domains, etc. In general we can also deal with IDN domain names, even though not officially supported by WHMCS. A drop-catching Addon to get Domain Backorders introduced in WHMCS A SSLCert Addon A PremiumDNS Addon A module for high performance availability check A widget offering you a module version overview (to see if there are new versions available) A widget showing your account balance at HEXONET (as we have a prepaid backend system) A module helping you to import domains in case you're starting with WHMCS / transferred to us using a non-whmcs way Find all our modules in our github company space: https://github.com/hexonet. We have big plans in Queue and as said, we do our best supporting our customers.
      Patching / Extending our modules in general happens in short as of existing CI / CD automation.
       
      If you need assistance when starting with us or if you have any related questions, just get in touch with us / let me know.
       
      Best Regards
      Kai
       
  • 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