\Attribute
Represents a {@link Product} Attribute, e.g: Size, Color, Material etc.
Attributes are created in the where they can be set with default
Options. They are then selected on each product they relate to. Once an attribute
is added to a Product, that Product needs to define some Options for that Attribute
and also have some Variations. If the Product does not have Variations when it needs to
then it cannot be purchased.
- Author: Frank Mullenger <frankmullenger@gmail.com>
- Copyright: Copyright (c) 2011, Frank Mullenger
Synopsis
class Attribute
extends DataObject
implements
PermissionProvider
{
- // members
- private static string $singular_name = 'Attribute';
- private static string $plural_name = 'Attributes';
- public boolean $firstWrite = false;
- private static Array $db = ;
- private static Array $has_many = ;
- private static array $has_one = ;
- private static Array $searchable_fields = ;
- private static Array $summary_fields = ;
- private static string $default_sort = 'SortOrder';
- // methods
- public void providePermissions()
- public void canEdit()
- public void canView()
- public void canDelete()
- public void canCreate()
- public FieldList getCMSFields()
- public void OptionSummary()
- public void TitleOptionSummary()
- public void onBeforeWrite()
- public void onAfterWrite()
- public void getOptionField()
Hierarchy
Extends
- DataObject
Implements
- PermissionProvider
Members
private
- $db
—
Array
DB fields for the Attribute - $default_sort
- $has_many
—
Array
Has many relations for the Attribute - $has_one
- $plural_name
- $searchable_fields
—
Array
Searchable fields for Attributes - $singular_name
- $summary_fields
—
Array
Summary fields for Attributes
public
- $firstWrite
Methods
public
- OptionSummary()
- TitleOptionSummary()
- canCreate()
- canDelete()
- canEdit()
- canView()
- getCMSFields() — Add some fields to the CMS for managing Attributes.
- getOptionField()
- onAfterWrite()
- onBeforeWrite()
- providePermissions()