Attributes

Attributes are groups of properties that can be assigned to products. They can also be used as category filters showing a filtered list of products containing specific attributes.

Entity Object

To create a new attribute group with 3 values:

$attribute_group = new ent_attribute_group();
$attribute_group->data['name']['en'] = 'Color';
$attribute_group->data['values'][] = ['name' => ['en' => 'Red']];
$attribute_group->data['values'][] = ['name' => ['en' => 'Green']];
$attribute_group->data['values'][] = ['name' => ['en' => 'Blue']];
$attribute_group->save();

Reference Model

Attributes doesn't have a reference object. Instead, values from the entity will be returned.

echo reference::attribute_group($group_id)->name[$language_code];

Revisiot

Äskettäin muokatut artikkelit