Jump to content

Adding new Attribute Group


ovoce
 Share

Recommended Posts

Hi,

 

i am trying to create new attribut group by code, and then add attributes to it. But this code below doesn't work - I dont know, what I am doing wrong:( - anyone can help ?

 

  $newAttGroup = new AttributeGroupCore();

  $newAttGroup->name[0] = 'sample name';
  $newAttGroup->public_name[0] = 'sample name';

  $newAttGroup->is_color_group = 0;
  $newAttGroup->group_type = 'test';
  $newAttGroup->position = 0;

  $newAttGroup->add();

 

 

EDITED:

 

Changed to:

 

  $newAttGroup = new AttributeGroupCore();

  $newAttGroup->name[0] = 'sample name';
  $newAttGroup->public_name[0] = 'sample name';

  $newAttGroup->is_color_group = 0;
  $newAttGroup->group_type = 'test';
  $newAttGroup->position = AttributeGroupCore::getHigherPosition() + 1;

  $newAttGroup->add();

 

and it works - don'T know why ... :/

Edited by ovoce (see edit history)

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