Hi everybody,
I've modified my Bank Transfer payment option to a manual Bitcoin payment option with BTC as a custom currency.
When BTC is chosen as a currency, Paypal doesn't show up, which is good because it doesn't support BTC.
I would like the inverse, that when USD/EUR/GBP is active, the Bitcoin (modded Bank Transfer) payment option is hidden.
How would one do this? Any smart coders who know what code to add?
Thank you! Best regards,
I've modified my Bank Transfer payment option to a manual Bitcoin payment option with BTC as a custom currency.
When BTC is chosen as a currency, Paypal doesn't show up, which is good because it doesn't support BTC.
I would like the inverse, that when USD/EUR/GBP is active, the Bitcoin (modded Bank Transfer) payment option is hidden.
How would one do this? Any smart coders who know what code to add?
Thank you! Best regards,
You should use the condition to hide the Bitcoin payment option. It checks that the current store currency is not Bitcoin.
I can't say the exact placement for the condition because I am not familiar with the custom changes that you've done.
Hope it helps,
Andrei.
Code: Select all
if ($this->currency->getCode() != "BTC")
I can't say the exact placement for the condition because I am not familiar with the custom changes that you've done.
Hope it helps,
Andrei.
Andrei
andrei.opencart[at]yahoo.com
Themes and Extensions
You could also use Restrict Payment Methods to do this, if you aren't able to modify the code yourself.
Thanks so much for the code Andrei! I would very much appreciate help with placement.andrei.bogdan wrote:You should use the conditionto hide the Bitcoin payment option. It checks that the current store currency is not Bitcoin.Code: Select all
if ($this->currency->getCode() != "BTC")
I can't say the exact placement for the condition because I am not familiar with the custom changes that you've done.
Hope it helps,
Andrei.
Clarification:
— The Bank Transfer can be considered as unmodified. Only the wording in bank transfer is changed to instruct the user to pay to a Bitcoin account instead of bank account. No further changes.
— I would like to hide the Bank Transfer payment (reworded as Bitcoin) if USD/EUR/GBP is selected. The only other payment I offer is Paypal Standard.
Where do i put this code snippet for this to work?
Big thanks!
Jonathan: Thanks for the tip! Your extension would be ideal and seems very appreciated. But feels like buying a cow when I need a glass of milk

No worries, just thought I'd point it out in case you can't get other solutions working. Andrei's code should probably be placed in the model file for the Bank Transfer method, which would be:
/catalog/model/payment/bank_transfer.php
Anywhere in the getMethod() function should be fine, something like:
/catalog/model/payment/bank_transfer.php
Anywhere in the getMethod() function should be fine, something like:
Code: Select all
if ($this->currency->getCode() != "BTC") return;
Just replace BTC with AUD in the example code given.
Or use Restrict Payment Methods like I mentioned before.
Or use Restrict Payment Methods like I mentioned before.
Who is online
Users browsing this forum: No registered users and 8 guests