Author Topic: How can you add BTC as a currency? Numeric code not accepted by virtuemart  (Read 493 times)

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
Hello,
I am trying to add Bitcoin as a currency, but that seems impossible because in Configuration -> Currencies -> New you can fill out the data for Bitcoin,
but the field "Numeric Code" makes it impossible to add Bitcoin as it has no  ISO 4217 numeric code.

I bought the Coinbase Commerce payment plugin to make it possible to accepte BTC payments,
but now it turns out you can not add BTC in Virtuemart itself....

Does anyone know how to add BTC as a currency in Virtuemart?

Thanks and regards

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3331
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
If your currency have no official iso number, define your own and use one that cannot conflict.
Max value is 2147483647

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
Hi Studio 42,

Thank you for helping. Could you please explain a little bit more how to "define your own" . What files do I have to edit? It is not just picking a number and using it, is it?
In the Currencies -> Currency Details -> Numeric Code you can only enter a number of 3 digits maximum.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3331
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
I have never try, but you can check wat number is not used in your database, you have not 999 currency numbers in the world
See https://fr.iban.com/currency-codes.html or download it here https://www.currency-iso.org/en/home/tables/table-a1.html but i think that you find this list in many other websites

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26967
  • Always on vacation
    • Jenkin Hill Internet
The ISO 4217 currency code for Bitcoin is XBT. However, at the moment it is an unofficial code according to the ISO 4217 standard.

https://www.xe.com/currency/xbt-bitcoin
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM..3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
Hi,

Thank you for helping. I tried to enter XBT in the Numeric Code field, but it does not accept letters, only digits. With phpMyadmin I looked up the table virtuemart_currencies , currency_numeric_code  which is set to int(4). Maybe I can change that so it accepts letters too. Maybe that is something that can be adjusted in virtuemart in future, would be great if you couls easily add cryptocurrencies too.

Cheers

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
I tried several un-used Numeric Codes but if I select Bitcoin as currency, the price does not show in the front-end.
Hopefully there are users who know how to get virtuemart show prices in Bitcoin, that would ge great.
This is what I did to add Bitcoin;

Configuration -> Currencies -> +New   add Bitcoin as currency with following settings:

currency Name: Bitcoin
Published: Yes
Exchange Rate: 0.0000
Code 2 Letters:
Code 3 Letters: BTC
Numeric Code: 181                 (I also tested with 045, 991 and 999 )
Currency Symbol: Ƀ                 (Thai Baht symbol, resembles BTC symbol the most)
Decimals: 8
Decimal Symbol: .
Thousands Separator: ,
Positive Format:
Negative Format:

In Shop -> Shop -> Vendor  the Currency is set to Bitcoin and the List of accepted currencies are: Bitcoin and United States Dollar  -> if I select United States Dollar then the prices show in $ in the front-end, if I select Bitcoin no prices are shown)

In Products -> Product -> Product Information I have a product with Cost price: 0.025 and Bitcoin selected to the right of it. -> it makes no difference if I select Bitcoin or USD, in both cases the price does not show. Also, in the Producs List the column Produc Price does not show a value.

If anybody knows the way how to get your Product Price show in Bitcoin in the front-end, please let me know, thank you!



jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26967
  • Always on vacation
    • Jenkin Hill Internet
I have never done it for BTC but the character code is <i class="fa fa-btc"></i> using Font Awsome
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM..3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
Thank you for the tip.

I do not understand why Virtuemart does not show the price as soon as you set it to Bitcoin, even while BTC is added as a new currency. I guess it has to do with the Numeric Code.
Is there a way around maybe by editing code?

I bought the CoinBase Commerce plugin especially to be able to process Bitcoin payments, but now it turns out Virtuemart can not handle Bitcoin.... :-\

By now I have spend 2 days trying to solve this. It is a pity but I guess I have to move over to another shop that is capable of processing BTC prices and payments...  :'(

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1657
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
This sound to me like hogwash, is it this plugin You bought ?

https://extensions.joomla.org/browse/new/extension/extension-specific/virtuemart-extensions/coinbase-commerce-cryptocurrencies-for-virtuemart/

If the developer states that it should work with Virtuemart, then it should. Contact the developer, this should not be so hard.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
Thank you for the tip, I already emailed them. It is that plugin yes.
But the plugin only comes in play after you added the product to the Cart and proceed to the Payment.
The problem of the price not showing up, occurs well before that, at the moment you try to add Bitcoin as a currency and try to show it on the frontside...

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26967
  • Always on vacation
    • Jenkin Hill Internet
now it turns out Virtuemart can not handle Bitcoin.... :-\

Of course VM can handle any currency, no matter what the actual currency, GBP, USD, EU etc, VM works just with numbers, it is just the symbol that changes. Getting a suitable symbol to show could be done by using a suitable unused or real ISO code and attaching the symbol to that. Alternative route would be to use template overrides.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM..3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
hi jenkinhill,

I wish you were right it was that simple and just a symbol problem. I am sure you won't be able to either to come up with prices in the frontend if you add BTC. Just try this:

Configuration -> Currencies -> +New   add Bitcoin as currency with following settings:

currency Name: Bitcoin
Published: Yes
Exchange Rate: 0.0000
Code 2 Letters:
Code 3 Letters: BTC
Numeric Code: 181                 (I also tested with 045, 991 and 999 )
Currency Symbol: Ƀ                 (Thai Baht symbol, resembles BTC symbol the most)
Decimals: 8
Decimal Symbol: .
Thousands Separator: ,
Positive Format:
Negative Format:

In Shop -> Shop -> Vendor  the Currency is set to Bitcoin and the List of accepted currencies are: Bitcoin and United States Dollar  -> if I select United States Dollar then the prices show in $ in the front-end, if I select Bitcoin no prices are shown)

In Products -> Product -> Product Information I have a product with Cost price: 0.025 and Bitcoin selected to the right of it. -> it makes no difference if I select Bitcoin or USD, in both cases the price does not show. Also, in the Producs List the column Produc Price does not show a value.

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1657
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
If you had looked at the dollar specification you would have seen something like this
{symbol} {number}
This is for showing positive numbers, work out the details for the negative numbers and put that also into currency bitcoin.
Regards
Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

virtuoos

  • Beginner
  • *
  • Posts: 8
  • A beginner
Jörgen, THANK YOU VERY MUCH!
You are the KING  :D