toplakd Posted March 27, 2020 Posted March 27, 2020 (edited) 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: Edited March 27, 2020 by toplakd 2
toplakd Posted April 7, 2020 Author Posted April 7, 2020 (edited) 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 April 7, 2020 by toplakd
datakick Posted April 7, 2020 Posted April 7, 2020 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), 1
toplakd Posted April 7, 2020 Author Posted April 7, 2020 (edited) 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 April 7, 2020 by toplakd
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now