Storing parts of the product in the basket line¶
CatalogElementSerializeService service is used for the serializing and unserializing of catalog element.
It implements the
This feature ensures that the basket always contains information about the products that are being ordered. When the customer sends an order, the shop can verify if all relevant product data for the order is present, even if the product was meanwhile removed from the product catalog.
refreshCatalogElementAfter defines how long the catalog element will be used from the basket line until it is refreshed from the catalog.
The service is using all attributes of the catalog element, that are set in the configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
By default, all base attributes are set in the configuration and the dataMap attributes are empty.
You can override this configuration, but make sure all required base attributes are specified,
otherwise it is not possible to create a new
CatalogElement from the serialized version.
Also make sure that the attributes you specify are either simple datatypes (int, float, boolean, string, array) or instances of FieldInterface.
All other objects will be ignored, because it is not possible to assure that the serializing process will work properly.
CatalogElement is stored in the basket line using the Doctrine listener. This listener uses the serialize service.
This listener listens to different events to make sure that the catalog element is ALWAYS of type
CatalogElement in the shop, and of
longtext (serialized string) type in the database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Depending on the event the catalog element from basket line is either serialized to a string or unserialized to a