I want to use another character instead of a dot or comma ("." & ",") in WHMCS prices, especially in invoices PDFs. Currencies' settings just allow you to choose from 4 predefined formats that are not what I need.
Could someone please tell me how to change this character? please also tell me the file names that should be edited, not only a line of code that I don't know where should I insert it.
Thanks a lot
I solved my problem with the help of Brian from WHMCS community. Here's the solution:
if we take amount as an example. and say we want to change . to * , we would edit the invoicepdf template and change..
<td align="center">' . $item['amount'] . '</td>
to...
<td align="center">' . str_replace('.','*',$item['amount']) . '</td>
and then you would do the same with any other priced variables in the template, e.g tax, subtotal, total etc.
Related
I am trying to setup a Telegram Instant View for a website.
this website has a lot of empty tags that i don't know how to remove them.
<p style="text-align: justify;"> </p>
i want to find a way to remove and get rid of these kind of tags
If you want to remove just use #replace function:
#replace("\u00a0", ""): //nodes/text()
If you want to remove tags with spaces, call #remove and pass a predicate, that selects empty nodes after space normalization.
#remove: //nodes[not( normalize-space(text()) )]
I found it Ehasn:
First replace all " " content with sample string like "null-tag" the remove them using this code:
#replace("\u00a0", "null-tag"): //p
#remove: //p[.="null-tag"]
Note that it might change some contents check some pages to make sure it work fine for you.
I'm trying to write an array to a CSV file. In the past, I've just used:
my_array.to_csv
and quotes be damned. But I have to conform on this particular file I'm writing to the CSV "standard". That means that, where this:
a,b,c,"d, with a comma",e
was satisfactory before, now I must output:
"a","b","d, with a comma","e"
There must be some easy way, but I can't find it.
I tried:
x.map{|v| '"' + v + '"'}.to_csv
but the file ended up with:
"""a""","""b""","""c"""
I've tried a bunch of variations on that. I ALWAYS end up with 3 quote characters.
The only thing that works is this:
fout.puts x.map{|v| "\"#{v}\"" }.to_csv.gsub('"""','"')
Which of course is hideous. Any help is appreciated!
Simply add an option:
my_array.to_csv(force_quotes:true)
You can check out more options here
better way follow
assuming a is array initially
a ="'" + a.join("','") + "'"
Strange I can't find this information online, does anyone know how to search and replace a full word for something else?
For example:
<div class="cell_user" alt="hotel Review - Young couple">
I want to remove: "hotel Review - " so I am left with:
"Young couple"
It seems to be something to do with fn:replace but I cannot find a single example anywhere of someone using it!
Thanks for any advice
If you have a constant prefix or infix string as in your example you can always use a string function such as substring-after():
"substring-after(//div[#class = 'cell_user']/#alt, 'hotel Review - ')"
You may want to tweak the beginning of the XPath expression a little bit to be more selective depending on your context. Also see xsl substring-after usage.
If you know that the relevant part is always after a hyphen and there is always only a single hyphen in your string you may even write
"substring-after(//div[#class = 'cell_user']/#alt, '- ')"
I have a problem in my magento, in my product category it has a name "MANGO/ BANANA".
now in my .csv to import it, it lookd like this.
_category
------------
Category/MANGO/ BANANA
and i got this error
Category does not exists in rows:(..)
I think the magento look for the BANANA dir, but my directory name in "MANGO/ BANANA"
does anyone have an idea about my case?
on how can I put "MANGO/ BANANA" in the _category field in my .csv?
thanks in advance
Try escaping the forward slash with a backslash: "MANGO\/ BANANA"
For categories having slash in their name you must use ASCII character of slash like /.
So here are the steps I took and hopefully this helps anyone that’s run into this problem that doesn’t want to change their category names to remove their /’s all together.
Manage Categories > replace / with /
I had over 70 categories to deal with so it was easier to make a import/export profile http://www.templatemonster.com/help/magento-how-to-exportimport-data-in-csv-files.html#gref and edit using Find/Replace in excel/openoffice or you can download an extension to help you.
Open your product spreadsheet, go to the Categories column, using Find/Replace to do the substitution.
Import!
Hopefully this is helpful to you all!
I read this from this article.
What is the globally accepted way of displaying international currencies?
For example: US$20, $20, $20 (US), €20, 20€, etc?
If there are many ways to show each currency, what is a good general way of showing currency?
I didn't find any single way. That said:
Show the amount (obviously)
Show the ISO currency code
Optionally show a user-friendly symbol
Don't rely on $ or £ -- several currencies use these symbols. ISO currency codes make it unambiguous. I usually do:
[user-friendly-symbol][amount] [iso code]
For example, $100 USD or €2,000,000 EUR
For the thousand separator, I usually take the local user's preference, rather than trying to figure out if that currency is generally formatted with , or .
See ISO 4217
ISO Currency Codes are the standard, although you might want to special-case certain common currencies (eg, USD, GBP, JPY, EUR etc) and display their symbols too.
ISO 4217
This has been a popular issue around here. See if any of these help you out:
Best Practice - Format Multiple Currencies
Proper currency format when not displaying the native currency of a culture
Currency formatting
I think it's generally accepted this is the best way to do it:
USD$30
AUS$40
And these currencies are displayed like this by default:
£20
€20
The ISO 4217 currency code plus the value. So USD20, EUR20.
I do not work in this field but I believe it should be displayed with a 3 letter code after the sum like :
20 EUR
105 GBP
86.4 USD
There are so many countries using dollars, francs (except France, using euros now) and so on
There is still the problem of the separators:
1,000,000.00 USD but
1 000 000,00 EUR here in France