prak Posted March 16, 2017 Share Posted March 16, 2017 Hello, I am trying to add a new attribute group, programmatically, by getting values from a form in the back office this way. I The values of the inputs to the php file using ajax. $newGroup = new AttributeGroup(); $newGroup->name = $name[0]; $newGroup->public_name = $public_name; $newGroup->group_type = 'select'; $newGroup->add(); but I get this error message in the console ""Uncaught PrestaShopException: Property AttributeGroup->name is empty" A new attribute group with no name is added in the product attributes list Is this an incorrect way of adding a new attribute group? If so, how can I do this? Help will be greatly appreciated Link to comment Share on other sites More sharing options...
polosat Posted March 17, 2017 Share Posted March 17, 2017 Hello, You need to specify the language id. You can set it this way: $newGroup = new AttributeGroup(null, $id_lang); Or this way: $newGroup = new AttributeGroup(); $newGroup->name[$id_lang] = 'some name'; $newGroup->public_name[$id_lang] = 'some name'; Where the $id_lang is some language id, for example $this->context->language->id 1 Link to comment Share on other sites More sharing options...
prak Posted March 17, 2017 Author Share Posted March 17, 2017 Thank you very much, Polosat! Link to comment Share on other sites More sharing options...
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