Search

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

%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
Note

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

Code Block
titleExample:
//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. 

...

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

TextLineField

Include Page
TextLineField
TextLineField

TextBlockField

Include Page
TextBlockField
TextBlockField

ImageField

Include Page
ImageField
ImageField

ArrayField

Include Page
ArrayField
ArrayField

PriceField

Include Page
PriceField
PriceField

...