Jump to content

TLD & Pricing Sync - setYears


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

Link to comment
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']));

 

Link to comment
Share on other sites

  • 2 weeks later...
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.

 

Link to comment
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à.
 

Link to comment
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?

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.

×
×
  • 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