Akeneo module doesn't have prices in the dataset


#1

Right now, I can see in data/import/maps/product_models.json following node:
“price”:[{“locale”:null,“scope”:null,“data”:[{“amount”:“149.90”,“currency”:“EUR”}]}]

However, none of this can be seen in the $dataSet within
\Pyz\Zed\DataImport\Business\Model\ProductAbstract\AddCategoryKeysStep::execute
which is the first step during import according to

Why is that?


#2

We have two different strategies for mappers: MapInterface::MAPPER_STRATEGY_SKIP_UNKNOWN and MapInterface::MAPPER_STRATEGY_COPY_UNKNOWN.

I think the point is in SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Mapper\Map\ ProductModelImportMap doesn’t handle the prices and use skip unknown strategy, so you don’t see the prices in dataset.

If you check SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Mapper\Map\ProductImportMap you will see how the prices are handled there.


#3

@volodymyr.hrychenko I don’t think that’s it.
if I try to print the $Item within “prices function” at

I cannot see “prices” key anywhere in the output, and it’s not there when I change the strategy in the class to MAPPER_STRATEGY_COPY_UNKNOWN either


#4

Ok, maybe then there is a slight confusion here:

we look at
product_models.json -> abstract products
and
ProductImportMap -> concrete products
!

That might be the mismatch here. In the example situation prices are expected to be attached to concrete products / product variants.

Does this point you in the right direction?


#5

it’s already in the demo branch pointed in the first post/comment


#6

Please see edited answer above (i somehow was confused and left it open, so I edited it instead posting a new comment. Sorry! :blush: )


#7

Not really. From what I see in Spryker Admin, price for model product CAN be set, so it should be doable within the importer.
json model file has the price in it. What I’m asking is how to access the data from the model file during the model data import.


#8

So, to get that right:

Apparently the example assumes that prices are on variants, not models. (Maybe this should be pointed out somewhere more clearly.)
But, your Akeneo data contains prices on product models.

Is that correct so far?


#9

Even if example code assumes something, I asked how I can reach the price in the product model import. If the code worked another way there would be no questions asked :slight_smile:

It doesn’t really matter what’s in akeneo and where in akeneo it is. As far as I understand, the import process uses JSON model file ONLY, and the price is there. What I’m looking for is how I can access the price node from model JSON within model import process, nothing else.