Using of Interpreter with ObjectValue


#1

Hello Guys,

i’m new to using Pimcore 5 and I want to Implement the E-Commerce Framework. Now for the Index Service i need an Interpreter with ObjectValue because I want to get the value of a related Object. This part of my YAML file looks like this:
interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\ObjectValue
interpreter_options:
target:
fieldname: ‘name’
locale: ‘%%locale%%’
So the Problem is when I’m running the code I only get NULL values inside the tables in the database. Now I was thinking that maybe it has to do something with the class DefaultProduct and that I need to override some methods there. Can you guys help me, because I don’t get enough information about that from the Documentation. Also my php.log file strangely stopped working so I can get no further information from there. Before that happened it said something like it couldn’t extend IIndexable in my DefaultProduct class.

Many Thanks,

Daniel Hirsch


#2

Hi,
just tried it myself, this should work. Important is only, that the field is a single-relation (href), not a multi relation (mutlihref, etc.).

Configuration that works for me:

brand:
    type: 'varchar(255)'
    interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\ObjectValue
    interpreter_options:
        target:
            fieldname: 'name'
            locale: '%%locale%%'

This should work completely generic and has nothing to do with the DefaultProduct class of the demo.

BR
Christian


#3

Thank you very much Christian. I used multi relations instead of single ones.

Sincerely,

Daniel Hirsch