Nelson Neoh Posted April 16, 2021 Share Posted April 16, 2021 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. Tried with the setMinYears(1) and setMaxYears(10), but no use, the imported TLD is only configured 1st year price tier. TQ. Best Regards, Nelson 0 Quote Link to comment Share on other sites More sharing options...
Nelson Neoh Posted April 19, 2021 Author Share Posted April 19, 2021 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'])); 0 Quote Link to comment Share on other sites More sharing options...
Magicklug Posted April 19, 2021 Share Posted April 19, 2021 Just what I need, thanks. 0 Quote Link to comment Share on other sites More sharing options...
PapaKai Posted April 27, 2021 Share Posted April 27, 2021 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). 1 Quote Link to comment Share on other sites More sharing options...
Nelson Neoh Posted May 4, 2021 Author Share Posted May 4, 2021 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. 0 Quote Link to comment Share on other sites More sharing options...
PapaKai Posted May 4, 2021 Share Posted May 4, 2021 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à. 0 Quote Link to comment Share on other sites More sharing options...
Nelson Neoh Posted May 4, 2021 Author Share Posted May 4, 2021 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? 0 Quote Link to comment Share on other sites More sharing options...
PapaKai Posted May 4, 2021 Share Posted May 4, 2021 Prices are automatically calculated by WHMCS: Quote termprice = term * registerPrice This is very strict and does not allow for importing special prices. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.