%ses-brand uses own fields to store ecommerce related data, e.g for the catalog or basket.


The shop provides a flexible way to store data using concrete instances of classes implementing the FieldInterface and inheriting from the AbstractField class. Fields are used for fixed attributes of a product/catalog and flexible attributes (property "dataMap" in CatalogElement).

Each instance of a concrete Field will provide the following methods:

MethodDescription
getTypeIdentifier()Returns the identifier of the Field (e.g. "sesimage")
isSearchable()Returns true, if the Field is searchable
isEmptyValue()Returns true, if the value of the Field is empty
getEmptyValue()Returns an empty version of the Field
toHash()Returns a associative array (hash) from the Field
fromHash($hash)Returns a created instance of the Field by associative array (hash)
toString()Returns the value of the Field as string

All AbstractField objects can be serialized, if you are using the methods toHash() and fromHash() before/after (un)serialize method.

//serialize
if($field instanceof AbstractField) {
    $fieldValue = serialize($field->toHash());
}


Class diagram

Implemented concrete Field classes

TypeUsed foridentifier
TextLineFieldA simple String without HTML-Codesestextline
TextBlockFieldA rich text field containing HTML codesestextblock
ImageFieldAn image contains a path to an image and an alternative textsesimage
ArrayFieldA structured arraysesarray
PriceFieldAn instance of the Price classsesprice

Used templates for rendering

For each concrete Field a templates has to be provided in order to render the Field in the template. 

The templates have to be provided in the folder FieldTypes. The name of the template has to start with the identifier of the Field, e.g.

The renderer provides a parameter $field providing the object of the given field.

Call from a twig template, via ses_render_field:

{{ ses_render_field(catalogElement, 'longDescription')|raw }}

TextLineField

TextBlockField

ImageField

ArrayField

PriceField