Modifier (OXID)

Sometimes it is necessary to enrich the data in the Makaira. This is realized by modifiers.

They reside in separate OXID modules and are PHP classes that extend \Makaira\Connect\Modifier.

The Makaira Connect module provides very easy to use events to modify and enrich the data during import.

This allows, for example, to create values for filters, to add content extensions to the fields or to concatenate several fields - all data is taken into account here. Makaira provides a naming of the new fields, which ensures the correct typing of the field. The correct typing is necessary so that the field can be used with the desired effect. Thus Makaira offers all basic data types int, float, time as well as several str types which are more suitable depending upon kind of the text. More details can be found under: Typing in Makaira Index

The removal of whitespaces in the article title will serve as an example here.
The apply() method is passed the object to be modified as an argument


namespace AwesomeShop\Makaira\Modifier\Product;

use Makaira\Connect\Modifier;
use Makaira\Connect\Type;
use Makaira\Connect\Type\Common\BaseProduct;

class TrimTitleModifier extends Modifier
     * Modify product and return modified product
     * @param BaseProduct $product
     * @return BaseProduct
    public function apply(Type $product)
        $product->title = trim($product->title);

        return $product;

Once the class has been created and can be loaded by the autoloader, it still needs to be registered as a modifier. This is done in the services.yaml in the root directory of your OXID module. This file is the definition for Symfony's dependency injection container. For more information, see the Symfony-Dokumentation and the OXID-Blog.

      - { name: 'kernel.event_listener', event: 'makaira.importer.modifier.product', priority: -1, method: addModifier }

The event name makaira.importer.modifier.product marks the modifier as an article modifier. Different event names are available for other document types:

Event-Name Modifier für
makaira.importer.modifier.product Artikel
makaira.importer.modifier.variant Artikel-Varianten
makaira.importer.modifier.category Kategorien
makaira.importer.modifier.manufacturer Hersteller

The priority of the modifier can be specified via Priority. This influences the loading order of the modifiers, whereby a modifier with a high value is loaded before a modifier with a lower value.

The function of the modifier can be checked using HTTP requests to the store.
See also: Signed requests with Postman


Migration from old Connect

If you still have an old OXID Connect module based on the marmalade :: Yamm module, the container configuration (in dic.php) must be migrated.

The container definition of our example would look something like this in the deprecated OXID Connect.

$dic['awesome_shop.makaira.product_modifier.trim_title'] = static function () {
  return new \AwesomeShop\Makaira\Modifier\Product\TrimTitleModifier();
$dic->tag('awesome_shop.makaira.product_modifier.trim_title', 'makaira.importer.modifier.product', -1);

This must be rewritten to the services.yaml format.