Jump to content

Adding second currency in invoices


MikeS24

Recommended Posts

Hi everyone!

To be clear, I am not a programmer, so my knowledge about the programming logic, dependecies and all that is close to 0. I am just figuring out things that are necessary for me one at a time as they come.

As some of you may already know, there are some countries in this world that require local currencies to be displayed on invoices. In my case it is Croatia. I am sweating my abs off trying to figure out some way to add the purchase value in another currency to our invoices. I feel that I've spent way too much time on this and it already becomes painful.


This is what I was able to come up with:
------------------------------------------------------------
<td>{$item.description}{if $item.taxed eq "true"} *{/if}</td>
<td class="text-center">{$item.amount} {if $clientsdetails.currency eq "2"} ({math equation="x * y" x=$item.amount|regex_replace:"/[^.,0-9]+/":"" y=1.82828 format="%.2f"} HRK){/if}</td>
------------------------------------------------------------

The way I see it, there is a problem with including math equations within {if} tags. Without "ifs" the equation works as intended and returns the correct value, but with them the value is empty. Unfortunately, it seems to me that those {if} tags are necessary in this scenario, with multiple currencies available for our clients.

And here comes my question, or rather "cry for help"... Would anyone be willing and able to help me out with rewriting this code or at least point me in the right direction? Of course it would be best to include a "live" currency conversion rate in place of the fixed convestion value, but I wasn't able to find out how to handle this.

I will be very very very grateful for any assistance with this.

Best Regards,
Michael

Link to comment
Share on other sites

Hi Michael,

On 22/12/2018 at 05:08, MikeS24 said:

I feel that I've spent way too much time on this and it already becomes painful.

that's working with WHMCS for you - get used to the pain! 🙂

On 22/12/2018 at 05:08, MikeS24 said:

The way I see it, there is a problem with including math equations within {if} tags. Without "ifs" the equation works as intended and returns the correct value, but with them the value is empty. Unfortunately, it seems to me that those {if} tags are necessary in this scenario, with multiple currencies available for our clients.

I don't see any issue with the IF statements... if it's not working when using them, then check whether the client meets the conditions used - e.g is their currency really "2" ??

On 22/12/2018 at 05:08, MikeS24 said:

And here comes my question, or rather "cry for help"... Would anyone be willing and able to help me out with rewriting this code or at least point me in the right direction?

as I said, it should work... although it's not how I would have done it... to avoid using regex, I would have done this..

{if $clientsdetails.currency eq "2"} ({math equation="x * y" x=$item.amount->toNumeric() y=1.82828 format="%.2f"} HRK){/if}

if you really wanted to, you could cut that right down and not even using math and multiply the variable directly....

{if $clientsdetails.currency eq "2"} ({(($item.amount->toNumeric())* 1.82828)|string_format:"%.2f"} HRK){/if}

both versions give the same result...

7gV241S.png

On 22/12/2018 at 05:08, MikeS24 said:

Of course it would be best to include a "live" currency conversion rate in place of the fixed conversion value, but I wasn't able to find out how to handle this.

the information is out there...

the above is mainly concentrating on the PDF invoices, but it's the same principle with the HTML invoice... you are going to do one of two things - either you write a ClientAreaPageViewInvoice hook to query the correct database table to get the current exchange rate; calculate your 2nd currency amount by multiplying/dividing 1st currency amount by exchange rate and return the values to the template... or you just query the database for the current exchange rate, return that value as a new variable available to the template and then do your calculations in the template as per your previous Smarty code above.

<?php

# Get Croatian Currency Exchange Rate
# Written by brian!

use Illuminate\Database\Capsule\Manager as Capsule;

function hook_currency_exchange_rates($vars) 
{
	$exchangerate = Capsule::table('tblcurrencies')->where('code','HRK')->get();
	return array("exchangerate" => $exchangerate[0]->rate);
}
add_hook("ClientAreaPageViewInvoice", 1, "hook_currency_exchange_rates");
?>

and then in the invoice template, you should just need...

{if $clientsdetails.currency eq "2"} ({math equation="x * y" x=$item.amount->toNumeric() y=$exchangerate format="%.2f"} HRK){/if}

or...

{if $clientsdetails.currency eq "2"} ({(($item.amount->toNumeric())* $exchangerate)|string_format:"%.2f"} HRK){/if}

the GBP->HRK exchange rate is currently 8.22657, so when we view the invoice again, we get the correct conversion...

2FnPTkq.png

pTnmz3T.png

if you're going to do this in the invoice PDF template, then abandon Smarty and hooks and just think PHP - the above thread should help more with that. thanks.png

Link to comment
Share on other sites

Hello Brian!

Big thanks to you for helping me out with this. And thank you for your time.
 

When it comes to my original idea with {if $clientsdetails.currency eq "2"} ({math equation="x * y" x=$item.amount|regex_replace:"/[^.,0-9]+/":"" y=1.82828 format="%.2f"} HRK){/if}, unfortuantely the result of this was as below:

5xI007D.jpg

The currency ID definitely wasn't the issue, so I have no idea what the problem was.

But... Thankfully, by using the first one of your suggested edits with $item.amount->toNumeric() instead of regex, it worked!

LgwMfMN.jpg

Darn, I knew it must've been something as simple as that! Thank you!


When it comes to snatching the actual exchange rate, of course this would be a much simpler solution overall, without the need for manual file updates, so I'll definitely try this out. However, I am going to make about 5 different currencies available to choose from for our clients, so I have a feeling that this may be a tidy bit more complicated, because if I understand it correctly, the hook example that you've given me above applies to a single currency, so I imagine that it would be necessary to create multiple hooks for different currencies... or this may be even more complicated than this, since the currency exchange rates between "non-default" currencies aren't actually stored anywhere within database. Or there's always a possibility that I am missing something very obvious, because my brain likes to trick me into overcomplicating simple things.
 

Anyway, sticking to the "manual way" satisfies my needs for the time being, so I'm ok with this method.

I am truly grateful for your assistance with this.

Have a great time and Merry Chrismas/Happy Holidays to you, Brian!

Best Regards,
Michael

Link to comment
Share on other sites

5 hours ago, MikeS24 said:

However, I am going to make about 5 different currencies available to choose from for our clients, so I have a feeling that this may be a tidy bit more complicated, because if I understand it correctly, the hook example that you've given me above applies to a single currency, so I imagine that it would be necessary to create multiple hooks for different currencies... or this may be even more complicated than this, since the currency exchange rates between "non-default" currencies aren't actually stored anywhere within database. Or there's always a possibility that I am missing something very obvious, because my brain likes to trick me into overcomplicating simple things.

oh if you were going to do this for multiple currencies, what you would do in the one hook is get the current currency and then lookup the exchange rate... now if they are both non-default currencies, then same thing applies but you will need to do a little bit of maths to get the correct figure... the info is there - effectively what you would do is convert it to the default currency and then convert it to the desired currency...

if you don't figure it out, contact me in the new year and i'll walk you through it.

Link to comment
Share on other sites

Hi Michael,

14 hours ago, MikeS24 said:

That's pretty much what I was thinking. Converting the non-default currency into default and then to HRK. I'll run some tests and hopefully I'll come up with something.

I thought it might be helpful if I mentioned two further things for clarification...

firstly, the WHMCS Exchange Rate updates basically work by pulling the daily ECB (European Central Bank) XML feed - that feed is a list of 30+ currencies and gives the daily equivalent value of 1 Euro in those currencies - so it's not loading 30 different currencies and all the exchange rates between each of them, just the Euro exchange rate with each and then it can easily calculate the others from those values.

<Cube><Cube time="2018-12-21"><Cube currency="USD" rate="1.1414"/><Cube currency="JPY" rate="126.98"/><Cube currency="BGN" rate="1.9558"/><Cube currency="CZK" rate="25.855"/><Cube currency="DKK" rate="7.4670"/><Cube currency="GBP" rate="0.90215"/><Cube currency="HUF" rate="321.97"/><Cube currency="PLN" rate="4.2851"/><Cube currency="RON" rate="4.6389"/><Cube currency="SEK" rate="10.2733"/><Cube currency="CHF" rate="1.1312"/><Cube currency="ISK" rate="134.10"/><Cube currency="NOK" rate="9.9428"/><Cube currency="HRK" rate="7.4216"/><Cube currency="RUB" rate="78.2103"/><Cube currency="TRY" rate="6.0546"/><Cube currency="AUD" rate="1.6081"/><Cube currency="BRL" rate="4.4099"/><Cube currency="CAD" rate="1.5459"/><Cube currency="CNY" rate="7.8825"/><Cube currency="HKD" rate="8.9368"/><Cube currency="IDR" rate="16696.34"/><Cube currency="ILS" rate="4.3045"/><Cube currency="INR" rate="80.0400"/><Cube currency="KRW" rate="1282.71"/><Cube currency="MXN" rate="22.7547"/><Cube currency="MYR" rate="4.7608"/><Cube currency="NZD" rate="1.6925"/><Cube currency="PHP" rate="60.546"/><Cube currency="SGD" rate="1.5641"/><Cube currency="THB" rate="37.267"/><Cube currency="ZAR" rate="16.4753"/></Cube></Cube>

as an example, today on the ECB list, 1 EUR = 0.90215 GBP - however, on my dev, my default currency is GBP, so WHMCS does the calculation of 1/0.90215 to give me the GBP->EUR exchange rate of 1.10846

PZQl6oD.png

so if I wanted to calculate the exchange rate between two non-default currencies, in my case that could be USD->HRK with a default currency of GBP, I know that the GBP->USD rate is 1.2652 today, so USD->GBP would therefore be 0.79039 .... GBP->HRK is still 8.22657, so if we multiply one by the other (0.79039*8.22657), we get a USD->HRK exchange rate of 6.50219

I can double-check this by setting USD as my default currency and updating the exchange rates again...

nboBsvs.png

secondly, when it comes to the hook, you basically need to know two things:

  1. what is the client's currency
  2. what is the secondary currency exchange rate that you want to return for the client's currency.

so 1️⃣ can be taken care of by adding the code below to your hook function...

$clientcurrency = $vars['clientsdetails']['currency'];

that gives you a new variable, $clientcurrency, than you can use in your conditions.

i'm assuming for 2️⃣ that it's always going to be HRK - though it wouldn't really matter if it wasn't, it would just make the hook code a little longer...

as an early Christmas present from me, here's a replacement hook that should work for you - you'll have to change the IF statements to match your own currency conditions though... 🎁

<?php

# Get Croatian Currency Exchange Rate
# Written by brian!

use Illuminate\Database\Capsule\Manager as Capsule;

function hook_currency_exchange_rates($vars) 
{
	$clientcurrency = $vars['clientsdetails']['currency'];
	if ($clientcurrency == "1") { // GBP
		$exchangerate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
		return array("exchangerate" => $exchangerate);
	}
	elseif ($clientcurrency == "13") { // USD
		$usdrate = Capsule::table('tblcurrencies')->where('code','USD')->value('rate');
		$hrkrate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
		$exchangerate = number_format(((1/$usdrate) * $hrkrate), 5);
		return array("exchangerate" => $exchangerate);
	}
	elseif ($clientcurrency == "14") { // EUR
		$eurrate = Capsule::table('tblcurrencies')->where('code','EUR')->value('rate');
		$hrkrate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
		$exchangerate =  number_format(((1/$eurrate) * $hrkrate), 5);
		return array("exchangerate" => $exchangerate);
	}
	elseif ($clientcurrency == "15") { // HRK
		// do nothing - it is the secondary currency!
	}
}
add_hook("ClientAreaPageViewInvoice", 1, "hook_currency_exchange_rates");
?>

I should add that if I were writing this for a client, and if the second currency was always going to be HRK, I could cut this hook right down to it's bare bones (e.g remove all but one of these if statements) and it would be half the size... but as you said that you're not a programmer, and because I don't know exactly which currencies you have and which currency would be secondary for each of those currencies, i've tried to keep it simple and documented.

so in my dev, 1=GBP; 13=USD; 14=EUR and 15=HRK, and so what this hook will do is for GBP clients, return the HRK exchange rate (because GBP is the default currency, that's just a basic query to the database); for USD & EUR clients, it will calculate and return their HRK exchange rate; for HRK clients, assuming that Croatian invoice rules means that you only need to show HRK prices for non-HRK currencies, it does nothing... you don't really need it in the code, but I left it in in case you need to do something else for HRK clients.

in the template, you can also change your Smarty code from...

{if $clientsdetails.currency eq "2"} ({math equation="x * y" x=$item.amount->toNumeric() y=$exchangerate format="%.2f"} HRK){/if}

to...

{if $exchangerate} ({math equation="x * y" x=$item.amount->toNumeric() y=$exchangerate format="%.2f"} HRK){/if}

because now the logic of how to react to client currencies is in the hook and it is the hook that decides if and when the $exchangerate variable is returned to the template... so using the above hook as is, if the client used HRK, then $exchange rate would not be returned to the template and that Smarty if statement would be false... if they were USD customers, $exchange rate will be returned with the correct rate and the if statement true.

as I said in the other thread, using the above method, you're going to run into a potential issue with paid invoices using today's exchange rate rather than the rate on the date of purchase - that's fixable in the hook, but could get quite involved coding wise, so I may return to that in the New Year when the batteries are fully recharged... even with unpaid invoices, that's still an issue - but a harder one to fix.

hopefully the hook will give you the basis of a quieter seasonal break than you otherwise would have had... enjoy Christmas/New Year - I know that I intend to! 🎄

Link to comment
Share on other sites

  • 2 weeks later...

Hello Brian!

Please forgive me for responding to you just now, but I was really busy with setting all other things up before we go live, and I actually remembered about this little currency thingy just today.

First of all, you are a great guy, though I bet you hear this a lot. I am really thankful for all the time and energy you put into preparing the complete, ready to use code for my needs. Thanks for this wonderful gift!

I still have some more things I need to take care of today, but I will definitely let you know about how it went with implementing the code as soon as I'm done with it.

Once again, Big Thanks and Happy New Year!

Michael

Link to comment
Share on other sites

Hi again Brian!

The implementation of the code and hook for the viewinvoice.tpl went successfully. I have customized it with the currencies from my page and it works. Thank you for your generous help with this problem of mine.

Unfortunately, my lack of programming knowledge had hit me in the head once again and it really hurts me that I need to come here ask for help with yet another problem...

I've spent many hours already and I'm still trying to figure out how to handle the exchange code implementation in the invoicepdf.tpl. The way you explained it to me (and from I've learned from some of your other posts), the "inside" part of the hook code should be implemented into the PDF template directly and the conversion calculation formula should be placed in fields where it's necessary. I've learned that there must be some slight tweaking done to the code when we transfer it to the PDF template, but after trying couple different methods already I still don't get the correct secondary currency output on PDF invoices.

I feel that I've come really close to the correct format of the transferred code and calculation, but now I am kind of stuck with what I have and I'm not sure how to progress further. Below is the preview of the code the way I've implemented it inside invoicepdf.tpl.


 

$pdf->Ln(10);


###################################
##### currency_exchange_rates #####

$clientcurrency = $vars['clientsdetails']['currency'];
	if ($clientcurrency == "1") {
		$exchangerate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
	}
	elseif ($clientcurrency == "2") {
		$plnrate = Capsule::table('tblcurrencies')->where('code','PLN')->value('rate');
		$hrkrate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
		$exchangerate = number_format(((1/$plnrate) * $hrkrate), 5);
	}
	elseif ($clientcurrency == "3") {
		$eurrate = Capsule::table('tblcurrencies')->where('code','EUR')->value('rate');
		$hrkrate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
		$exchangerate =  number_format(((1/$eurrate) * $hrkrate), 5);
	}
	elseif ($clientcurrency == "4") {
		$gbprate = Capsule::table('tblcurrencies')->where('code','GBP')->value('rate');
		$hrkrate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
		$exchangerate =  number_format(((1/$gbprate) * $hrkrate), 5);
	}
	elseif ($clientcurrency == "5") {
		$jpyrate = Capsule::table('tblcurrencies')->where('code','JPY')->value('rate');
		$hrkrate = Capsule::table('tblcurrencies')->where('code','HRK')->value('rate');
		$exchangerate =  number_format(((1/$jpyrate) * $hrkrate), 5);
	}
	elseif ($clientcurrency == "6") {
	}


##### currency_exchange_rates #####
###################################



foreach ($invoiceitems as $item) {
    $tblhtml .= '
    <tr bgcolor="#fff">
        <td align="left">' . nl2br($item['description']) . '<br /></td>
        <td align="center">' . $item['amount'] . ' ('. number_format($item['amount'] * $exchangerate, 2, '.', '').' HRK)</td>
    </tr>';
}

 

And this is the result it gives me...

ZKGHiMj.jpg

I'm not sure what else I could do with this. I'll be grateful if you could take a look at it in your spare moment and let me know what am I missing or doing wrong.

Best Regards,
Michael

Link to comment
Share on other sites

Hi Michael,

3 hours ago, MikeS24 said:

I feel that I've come really close to the correct format of the transferred code and calculation, but now I am kind of stuck with what I have and I'm not sure how to progress further.

you did come close - the line that is wrong is...

$clientcurrency = $vars['clientsdetails']['currency'];

$vars is used in the Smarty templates, not in the invoice file - so it should be referenced using...

$clientcurrency = $clientsdetails['currency'];

with that change made, the IF statements should work (assuming capsule is enabled in your template and you'd get an error if it wasn't)...

CcBUD7u.png

Link to comment
Share on other sites

Thank you Brian.

I can't believe I have come this close to the solution, yet it would still take me eternity to figure this out on my own, haha...

Sadly, it seems that capsule might be indeed disabled in my template, because I am getting an "Oops! Something went wrong" page when trying to download PDF file. I had no luck trying to google how to enable capsule for the template (or it's possible that I simply don't know what to search for...). Is this an easy thing to do or am I totally... out of luck in this scenario?

Link to comment
Share on other sites

Of course, didn't I say I have a talent for overcomplicating things? I had this in mind, but it just seemed too simple of a solution to even consider this.

For some reason, it seems that this field with secondary currency on pdf invoices shows just the currency to currency exchange rate output, and not the actual calculation for of the specific price in the field. From what I see, it's the same way in the image you showed me with your GBP>HRK price output. The result is just the 1 GBP exchange rate.

CcBUD7u.png

 

I don't get why does it work this way, since the calculation formula seems to be formatted correctly and we actually see the correct exchange rate between two currencies being shown - it just doesn't seem to multiply the item price with this exchange rate.

('. number_format($item['amount'] * $exchangerate, 2, '.', '').' HRK)

 

I'm sorry for troubling you with this Brian, I know this might be getting annoying for you already.

Best Regards,
Michael

Link to comment
Share on other sites

Unbelievable... I've managed to solved it on my own!

It was necessary to get rid of the currency symbol before running the calculations. For some reason I thought the "number_format" thingy would do this, but it seems I was wrong.

Here's how I've done this (just in case anyone else would get stuck with the same problem):

Quote

$tempItemAmountSymbolRemove = preg_replace('/[\$]/', '', $item['amount']); 
$tempItemAmountFloat = floatval($tempItemAmountSymbolRemove);

    $tblhtml .= '
    <tr bgcolor="#fff">
        <td align="left">' . nl2br($item['description']) . '<br /></td>
        <td align="center">' . $item['amount'] . ' ('. number_format($tempItemAmountFloat * $exchangerate, 2, '.', '').' HRK)</td>
    </tr>';

 

Once again, thank you for your help and guidance Brian!

Link to comment
Share on other sites

On 11/01/2019 at 10:10, MikeS24 said:

I'm sorry for troubling you with this Brian, I know this might be getting annoying for you already.

oh no - I can manipulate Smarty and PHP for as long as necessary.. the day I grow tired of that, i'll go and do something else with my time!

i'd have replied before, but your posts must still be being moderated as there seems to be a delay in them being published and I didn't get any notification of the earlier post.

On 13/01/2019 at 19:42, MikeS24 said:

Unbelievable... I've managed to solved it on my own!

Of course, didn't I say I have a talent for overcomplicating things?

we can all be guilty of overcomplicating things... and I think you may have fallen into your own trap again. aaah.gif

On 13/01/2019 at 19:42, MikeS24 said:

It was necessary to get rid of the currency symbol before running the calculations. For some reason I thought the "number_format" thingy would do this, but it seems I was wrong.

the real problem (and I was an idiot for not noticing originally) is that $item['amount'] is a string - specifically, it's a price formatter string and so you can't really multiply it with a number.

so as per before, you can use toNumeric() to strip the currency prefix/suffix from the value and just return the actual number - that can be used in the calculation without the need for those two additional lines of code.

<td align="center">' . $item['amount'] . ' (' . number_format($item['amount']->toNumeric() * $exchangerate, 2, '.', '') . ' HRK)</td>
Link to comment
Share on other sites

Hey Brian,

Thank you for one another helpful input!

Yes, my posts are still getting through "purgatory" before they are released - it is a little annoying, but rules are the rules I guess.

I absolutely didn't assume "->toNumeric()" would actually work in this case, as I thought "number_format" is the PHP version of that, and the first one is only available in Smarty templates. Of course... assumptions... Thanks for pointing this out.

I think in a couple of days I will be trying to "save" the secondary currency value as a database entry, to solve the annoying problem with it changing every time the exchange rate gets updated. If I'm not mistaked, I have seen one of your posts where you explain how to do this with a hook. I'll try to figure it out, and hopefully I won't get stuck on my own stupidness again this time, haha...

Have a good time!

Best Regards,
Michael

Link to comment
Share on other sites

20 hours ago, MikeS24 said:

Yes, my posts are still getting through "purgatory" before they are released - it is a little annoying, but rules are the rules I guess.

I thought that stopped after you had made 5 posts... but ours is not to reason why. 🙄

20 hours ago, MikeS24 said:

I absolutely didn't assume "->toNumeric()" would actually work in this case, as I thought "number_format" is the PHP version of that, and the first one is only available in Smarty templates. Of course... assumptions... Thanks for pointing this out.

number_format is really just about defining the decimal places of the result and its general formatting...

20 hours ago, MikeS24 said:

I think in a couple of days I will be trying to "save" the secondary currency value as a database entry, to solve the annoying problem with it changing every time the exchange rate gets updated. If I'm not mistaken, I have seen one of your posts where you explain how to do this with a hook. I'll try to figure it out, and hopefully I won't get stuck on my own stupidity again this time, haha...

I think I explained roughly what needs to be done, but not necessarily how to do it lol.

Link to comment
Share on other sites

On 1/16/2019 at 3:52 PM, brian! said:

I thought that stopped after you had made 5 posts... but ours is not to reason why. 🙄

The posting lock should be lifted after "usually no more than 10" posts, according to the note I am seeing here.
 

On 1/16/2019 at 3:52 PM, brian! said:

I think I explained roughly what needs to be done, but not necessarily how to do it lol.

Well, it's likely that I just saw somebody else posting some info about how they did it, but from what I've noticed you're always all around the place helping people out with their problems, so big props to you anyway 😉

Next little-big thing I will be trying to do is an addon module for importing and setting the domain prices from my registrar's XML feed (also multiplying those prices by a fixed % to cover my markup). Actually I'm not gonna write the addon from the ground up myself, but use an existing module as a template and try to re-write it to achieve the needed outcome. From what I noticed by the comments that module is in a non-working state currently, so I might have to do some analysis on this matter also. I feel it's more than likely that I might be back here asking for a little assistance with this as well.

In the meantime, have a good time and stay awesome!

Link to comment
Share on other sites

On 20/01/2019 at 07:32, MikeS24 said:

The posting lock should be lifted after "usually no more than 10" posts, according to the note I am seeing here.

now that you've reached 10 posts, welcome to the big leagues! 🙂

On 20/01/2019 at 07:32, MikeS24 said:

Next little-big thing I will be trying to do is an addon module for importing and setting the domain prices from my registrar's XML feed (also multiplying those prices by a fixed % to cover my markup). Actually I'm not gonna write the addon from the ground up myself, but use an existing module as a template and try to re-write it to achieve the needed outcome. From what I noticed by the comments that module is in a non-working state currently, so I might have to do some analysis on this matter also. I feel it's more than likely that I might be back here asking for a little assistance with this as well. 

which registrar are you using ?

domain pricing import has always been awkward in WHMCS - not least, because there is no generic way to get the information... some registrars allow users to obtain pricing via API, others via csv and I daresay there are those that don't allow access to a users specific pricing info at all.

if you had said you were wanting to use csv, I might have suggested using the Hexonet ISPAPI Pricing Importer as a means to importing the prices - whether it's an option for you to convert the xml to csv and use the addon, I don't know - but if you do (and even if you don't and write another solution), backup the database before running it, just in case! 🙂

Link to comment
Share on other sites

Hey Brian!

Oh man, I feel you... I'm also a HUGE fan of censorship 🤢

Oh, and about that posting lock lift after "usually no more than 10 posts" - I believe I must be one of the "unusual" members, since the warning still appears above my input field. Finally something makes me feel special!
 

13 minutes ago, brian! said:

which registrar are you using ?

I am using NETIM as my domain registrar. I think their offer for resellers is probably one of the best in the market, at least for startups, though I wouldn't say the same about the quality of their admin panel and support... Anyways, from what I've noticed they allow us to get many info's through their APIs, including the full pricing list in XML format. There is already an addon for importing NETIM prices in CSV (in fact I think it's a script that converts that XML file to CSV) and using that with Hexonet's importer, however...

1) I think Hexonet's importer only includes main prices from those CSV tables (registration/transfer/renew) in the import process - without Redemption-Restore Fees, so I would still need to go through and edit those fields manually. If I was about to put hundrends of extensions in my offer, that still would be a painful experience... As well as having to set ID Protection / EPP Code availability (though in this case, I don't think there's any chance to handle this automatically, because that info is not included in the XML pricing list).

2) I was actually thinking of trying to rewrite this thing -> https://whmcs.community/topic/124653-easy-enom-tld-importer/ . I mean to make it work in general, because from what I see by users' posts the module is simply outdated. If that was done, there probably shouldn't be any problem with making this work with NETIM instead of ENOM (since originally the module took advantage of ENOM's XML list, so it would pretty much only require changing the XML link to NETIM's).

Little question: Do you have some experience/knowledge about how often does the domain pricing usually change? I am still learning things and I'd like to know, more or less, how often should I take care of updating domain prices. Unfortuntely they do not offer any monitoring/pricing change notifications at NETIM (at least for the time being).

 

Link to comment
Share on other sites

23 hours ago, MikeS24 said:

I am using NETIM as my domain registrar. I think their offer for resellers is probably one of the best in the market, at least for startups, though I wouldn't say the same about the quality of their admin panel and support...

i've read others say good things about them on here - though i've never personally used them and quickly looking at their wholesale prices, they're more expensive than i'm paying @ resell.biz (their redemption prices are far better though, but I never let domain renewals get to that stage anyway!)...

talking about support, don't forget that NETIM wrote their own WHMCS module and therefore it wouldn't be directly supported by WHMCS Support... which basically means don't update WHMCS until you know that the NETIM module will work with that WHMCS version - otherwise, you run the risk of losing functionality...

23 hours ago, MikeS24 said:

1) I think Hexonet's importer only includes main prices from those CSV tables (registration/transfer/renew) in the import process - without Redemption-Restore Fees, so I would still need to go through and edit those fields manually. If I was about to put hundreds of extensions in my offer, that still would be a painful experience...

virtually everyone using WHMCS has had to do that at some point - unless you're lucky enough to have a registrar that you can import pricing from...

23 hours ago, MikeS24 said:

As well as having to set ID Protection / EPP Code availability (though in this case, I don't think there's any chance to handle this automatically, because that info is not included in the XML pricing list). 

if you could add them manually in the csv, the Hexonet module should be able to import them...

with regards to IDP (Whois Privacy), generally speaking it should be available for gTLDs, but not for ccTLDs - but, just to make your life even more exciting than it already is, there are exceptions to each... e.g ccTLDs that are marketed as gTLDs (e.g .cc, .tv etc) will allow IDP... just take care because you can add IDP to any TLD in WHMCS and the client can order it, but that doesn't mean that it's available in the back-end... e.g you can setup .uk in WHMCS to offer IDP during registration, but .uk wouldn't support it... so you'd be charging a client (assuming you do charge for this) for a service you couldn't provide.

btw - unless NETIM have a downloadable list, you may have to work through their 800 TLDs and update the csv manually for IDP & EPP settings!

23 hours ago, MikeS24 said:

2) I was actually thinking of trying to rewrite this thing -> https://whmcs.community/topic/124653-easy-enom-tld-importer/ . I mean to make it work in general, because from what I see by users' posts the module is simply outdated. If that was done, there probably shouldn't be any problem with making this work with NETIM instead of ENOM (since originally the module took advantage of ENOM's XML list, so it would pretty much only require changing the XML link to NETIM's).

well if you were using PHP7, all of the SQL queries would need to be rewritten too for a start, plus the database table structures themselves will be slightly different and probably many other coding tweaks will be required too... 8 years is a long time and many things under the hood will have changed in WHMCS since then.

if you were looking at this with one eye on a commercial aspect of potentially selling the fixed addon to other eNom users, then there is already an eNom Domain Pricing Manager addon in Marketplace (I don't think it's using csv/xml)... so whether it would be commercially viable is a decision for you.

23 hours ago, MikeS24 said:

Little question: Do you have some experience/knowledge about how often does the domain pricing usually change?

little questions are often the most dangerous ones to answer!

there are two answers to this...

  • Most major registries tend to give advanced notice (often over a month) for price changes for their TLDs... so if NETIM don't automatically provide you with such info, perhaps keep an eye of NEO's Blog or other registrar sites for relevant announcements.
  • if you're non-US based but paying in USD, then currency fluctuations could have an impact on what it costs you to buy registrations/renewals, and hence what you need to charge your customers... let's go back pre-Brexit, and say a .com registration costs $10 USD (£6.76 GBP) - today that same $10 dollar domain might cost £7.75 GBP - that's a 14% price rise that you either absorb or pass on to clients.

with NETIM being based in France, I don't know how much their pricing is influenced by the USD-EUR exchange rate (though I don't think that rate has changed much over the last two years).... but it might be worth keeping an eye of if you're based in a location were the currency fluctuates in relation to the currency that you're buying your domains in.

Link to comment
Share on other sites

When it comes to NETIM, it actually came down in a "quick pick", when I've noticed that the previously chosen registrar didn't offer some extensions I really needed to put in my offer, I had to go look elsewhere and then I've found NETIM with their enormous catalogue of extensions to choose from.

To tell you the truth, I am not planning to make any business on reselling domains - I only want to offer them as a reasonably-priced option for my customers. Like one guy once said... "You're either in a hosting business, or in the domain business - it's hard to do both", and that sounds extremely true, expecially for a guy like me just starting out with a totally new venture.
 

2 hours ago, brian! said:

with regards to IDP (Whois Privacy), generally speaking it should be available for gTLDs, but not for ccTLDs - but, just to make your life even more exciting than it already is, there are exceptions to each...

Of course - and those exceptions as always complicate things a big way. For example: I've lately added some quite important ccTLDs to my list and extensions such as .de / .fr / .it / .uk all have ID Protection available for them. Btw. I do not plan to charge any fees for this option. Everyone should have the right to decide what they want to do with their info, and I don't intent to complicate this matter for anyone. 
 

3 hours ago, brian! said:

if you were looking at this with one eye on a commercial aspect of potentially selling the fixed addon to other eNom users, then there is already an eNom Domain Pricing Manager addon in Marketplace (I don't think it's using csv/xml)... so whether it would be commercially viable is a decision for you.

Not in the least. I don't want to make any business out of this thing, I only want to do this for myself - but if it works, I wouldn't mind sharing the addon with the community, just as the original author did. I may start with the first version of this addon, as it only has about 60 lines of code in it (without the later additions), and see where it takes me.

Once again, thank you for your input and assistance 😉
Have a good time, Brian!

 

Link to comment
Share on other sites

Btw. I've noticed that a new update for WHMCS just came out - with all your experience, would be be able to tell me whether it would be safe for me to run this update Especially considering the domain module - could it break anything there? Of course I know I'll have to backup all the non-template modified files before this.

Link to comment
Share on other sites

15 hours ago, MikeS24 said:

When it comes to NETIM, it actually came down in a "quick pick", when I've noticed that the previously chosen registrar didn't offer some extensions I really needed to put in my offer, I had to go look elsewhere and then I've found NETIM with their enormous catalogue of extensions to choose from.

nearly all of which no customer will ever purchase from you (unless you specialise in domains and tweak WHMCS to be more friendly in that respect - or are targeting a specific business audience where certain TLDs would be more relevant)...

15 hours ago, MikeS24 said:

To tell you the truth, I am not planning to make any business on reselling domains - I only want to offer them as a reasonably-priced option for my customers. Like one guy once said... "You're either in a hosting business, or in the domain business - it's hard to do both", and that sounds extremely true, especially for a guy like me just starting out with a totally new venture.

it is slightly true... the money is usually in hosting, the fun (for me) is with domains and the stress is trying to make WHMCS help you to do either efficiently! 🙂

15 hours ago, MikeS24 said:

For example: I've lately added some quite important ccTLDs to my list and extensions such as .de / .fr / .it / .uk all have ID Protection available for them.

no they don't - but yet NETIM offer the service on them... wtf go figure!

i'm sure that's against some ccTLD registry rules, yet if you're not charging and nobody is getting financially hurt... though could be construed as mis-selling - but that might come down to what exact service NETIM provide as IDP (I haven't checked).

15 hours ago, MikeS24 said:

Btw. I've noticed that a new update for WHMCS just came out - with all your experience, would be be able to tell me whether it would be safe for me to run this update Especially considering the domain module - could it break anything there?

for the time being, i'd hang on and not upgrade... unless v7.7 has a feature that you *must* have *now*, then there's no point is rushing towards that upgrade button.

if all that experience of mine that you mention is anything to go by, then there will be a v7.7.1 maintenance release some time in February to fix the bugs being found in the next few weeks that weren't picked up during the beta period... it also wouldn't surprise me to start seeing hotfixes within the next fortnight.

chances are if the NETIM module is working in v7.6, then it will likely work in v7.7 - but i'd suggest getting confirmation of that from NETIM before even thinking of upgrading.

Link to comment
Share on other sites

Hey Brian!

On 1/23/2019 at 1:20 PM, brian! said:

nearly all of which no customer will ever purchase from you (unless you specialise in domains and tweak WHMCS to be more friendly in that respect - or are targeting a specific business audience where certain TLDs would be more relevant)...

Well, of course I don't intend to put all 800 or so extensions in my offer - I'm not suicidal yet 😄 However, I simply like to have them there available for picking anytime I might have a need to add something new or just in case some client has a special request.
 

On 1/23/2019 at 1:20 PM, brian! said:

no they don't - but yet NETIM offer the service on them... wtf go figure!

i'm sure that's against some ccTLD registry rules, yet if you're not charging and nobody is getting financially hurt... though could be construed as mis-selling - but that might come down to what exact service NETIM provide as IDP (I haven't checked).

I must say, you have really shocked me with this piece of information... How the heck can they put that kind of info in their system when this is simply misinformative?! I mean, that information about Privacy option is visible both on their website and directly in their API, so it looks like they just don't give a blimp about what they put in there...

I have contacted Netim about this and will patiently wait to see what they have to say. In the meantime, do you know any reliable source where I could obtain the truthful information about what is and what isn't available for certain domain extensions? Or is it just necessary to go through all specific domain registries to obtain the 100% correct information?

Thanks for this, Brian.

Have a good time!

Link to comment
Share on other sites

12 hours ago, MikeS24 said:

How the heck can they put that kind of info in their system when this is simply misinformative?! I mean, that information about Privacy option is visible both on their website and directly in their API, so it looks like they just don't give a blimp about what they put in there...

as I said, it comes down to what they provide for that Privacy option - and perhaps its just easier for them to say it applies to all 800 TLDs, rather than having to make a list where it doesn't apply.

12 hours ago, MikeS24 said:

I have contacted Netim about this and will patiently wait to see what they have to say.

perhaps it might be helpful if I give you an example TLD that I know well - .uk.. if we do a whois lookup for whmcs.co.uk at Nominet's WHOIS page, we would currently get the following result...

Quote

Domain name: whmcs.co.uk

Data validation: Nominet was able to match the registrant's name and address against a 3rd party data source on 10-Dec-2017

Registrar: eNom LLC [Tag = ENOM]
URL: http://www.enom.com

Relevant dates:
Registered on: 06-Aug-2006
Expiry date: 06-Aug-2019
Last updated: 08-Jul-2018

Registration status: Registered until expiry date.

Name servers:
abby.ns.cloudflare.com
fred.ns.cloudflare.com

WHOIS lookup made at 11:11:47 30-Jan-2019

as you can see from the above output, the owner of a .uk domain is now hidden by default (even if a business) - similar output should occur for any .uk domain.... therefore, what would buying whois privacy for a. uk domain achieve as the information your wanting to hide is already hidden ?!?

12 hours ago, MikeS24 said:

In the meantime, do you know any reliable source where I could obtain the truthful information about what is and what isn't available for certain domain extensions? Or is it just necessary to go through all specific domain registries to obtain the 100% correct information?

i'd suggest working from the OpenSRS TLD Reference Chart as a definitive guide... whether IDP is allowed for a TLD is usually set by the registry itself for that TLD rather than any particular registrar - so it should be generically accurate (if it sells that TLD)... though there is always a chance that a registrar has done a deal with a registry to allow IDP for their customers, but that's rare...

TAkf8bP.png

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