Jump to content

How to add new customer group programmatically, in Prestashop 1.6


Recommended Posts

I'm creating a module, which need a new customer group, and I want to do it programmatically, I looked at the core code of prestashop "controllers>admin>AdminGroupsController.php" there is nothing useful there, and there is a method by name of addGroups in "classes>Customer.php" and this one is not able to do what I want. So, I would be thankful if someone help me.

Link to comment
Share on other sites

1 hour ago, arashonline said:

I'm creating a module, which need a new customer group, and I want to do it programmatically, I looked at the core code of prestashop "controllers>admin>AdminGroupsController.php" there is nothing useful there, and there is a method by name of addGroups in "classes>Customer.php" and this one is not able to do what I want. So, I would be thankful if someone help me.

$my_group = new Group();
$my_group->name = Name; //Careful with multilang
$my_group->price_display_method = 1;
$my_group->add();

 

  • Like 2
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...