Post by KNAS » Tue Mar 18, 2014 5:52 am

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,

Newbie

Posts

Joined
Mon Mar 17, 2014 6:20 am

Post by andrei.bogdan » Tue Mar 18, 2014 9:46 pm

You should use the condition

Code: Select all

if ($this->currency->getCode() != "BTC")
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.

Andrei
andrei.opencart[at]yahoo.com
Themes and Extensions


Active Member

Posts

Joined
Mon Mar 25, 2013 4:52 am

Post by Johnathan » Tue Mar 18, 2014 10:41 pm

You could also use Restrict Payment Methods to do this, if you aren't able to modify the code yourself.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by KNAS » Wed Mar 19, 2014 1:43 am

andrei.bogdan wrote:You should use the condition

Code: Select all

if ($this->currency->getCode() != "BTC")
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.
Thanks so much for the code Andrei! I would very much appreciate help with placement.

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 :) Appreciated though.

Newbie

Posts

Joined
Mon Mar 17, 2014 6:20 am

Post by Johnathan » Wed Mar 19, 2014 8:21 am

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:

Code: Select all

if ($this->currency->getCode() != "BTC") return; 

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by KNAS » Wed Mar 19, 2014 7:44 pm

And it works!

Big thanks Johnathan and Andrei! Much appreciated!

Newbie

Posts

Joined
Mon Mar 17, 2014 6:20 am

Post by woobu » Sun Feb 21, 2016 5:13 pm

I disablet all currencies but how to make visible if my defaul currency is AUD

Newbie

Posts

Joined
Sun Feb 21, 2016 5:12 pm

Post by Johnathan » Sun Feb 21, 2016 10:51 pm

Just replace BTC with AUD in the example code given.

Or use Restrict Payment Methods like I mentioned before.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 8 guests