Jump to content
thirty bees forum

Modules and Services - Payment enhancment


toplakd

Recommended Posts

In "Modules and Services" - Payment, there is a section "Country Restriction" for enabling/disabling payment options for each country.
Would it be hard to implement one additional checkbox that would show only Countries that are set as ACTIVE in "Localization / Countries" ?

As currently it shows complete list together with countries that are disabled (don't want to delete them in case I might need some of them later).

Picture attached:

1687478184_Screenshot_2020-03-27PaymentALZA-Racing.png.eb8e0a378542b0dc99094e6514fbe8bc.png

Edited by toplakd
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Currently I have to enable/disable payment options for countries on daily basis as carrier is adding/removing countries to its no-ship blacklist (covid related).

So i did some research in /controllers/admin/AdminPaymentController.php

At the line 308 I have changed

 'items'      => Country::getCountries($this->context->language->id),

to this

 'items'      => Country::getCountries($this->context->language->id, !$this->active),

And now my Country restrictions section is finally showing only the countries which are marked as active.

Would something like that be enhancement for normal behaviour?

Edited by toplakd
Link to comment
Share on other sites

18 minutes ago, toplakd said:

Currently I have to enable/disable payment options for countries on daily basis as carrier is adding/removing countries to its no-ship blacklist (covid related).

So i did some research in /controllers/admin/AdminPaymentController.php

At the line 308 I have changed


 'items'      => Country::getCountries($this->context->language->id),

to this


 'items'      => Country::getCountries($this->context->language->id, !$this->active),

And now my Country restrictions section is finally showing only the countries which are marked as active.

Would something like that be enhancement for normal behaviour?

Not really. Country active status should not prevent merchants from setting up payment modules.

For example, some merchants want to prepare multiple payment modules for some disabled country. Only after everything is set up then will enable the country, and this will actually show these new payment options in checkout page.

Your first suggestions - to handle this on front end via some javascript - is much better.

Also, AdminPaymentController does not contains $active property. So, $this->active always returns null,  and !$this->active always return true. So your change should look like this:

 'items'      => Country::getCountries($this->context->language->id, true),

 

  • Thanks 1
Link to comment
Share on other sites

Thank you for making good point and showing me the right way to do it.

Will try to make override for it for current time, and maybe someday we will get the checkbox to select only active.👍

Edited by toplakd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...