Jump to content

How to change default payment methods when adding new group ?


pierrepli
 Share

Recommended Posts

When I add a new group, all payment methods are selected by default for this group.

I'd like to restrict this to only one specific payment method, but can't find out how to do so.

Thx

Share this post


Link to post
Share on other sites

Hello, 

You could override Group class (classes/Group.php), and change addModulesRestrictions function.

In that function, it will affect all allowed modules to the group.

If you want to restrict to one payment method, you can check the id of the other payment method modules (ps_module table), and remove it from the $modules array variable. Then, just call the parent method with the new $modules variable.

If you're not developer you'll probably need to hire one to do it for you.

Share this post


Link to post
Share on other sites

It worked perfectly, thanks a lot !!
As I'm not a developper, I'm not sure my code is clean, but it works fine.
foreach ($modules as $module) {
            if ($module == '13' || $module == '59') {
                continue;
            }

            foreach ($shops as $shop) {
                $sql .= '("' . (int) $module . '", "' . (int) $shop . '", "' . (int) $id_group . '"),';
            }
        }

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More