Akeneo: Get Attributes from Variant Group

I want to check if some attribute values ​​have changed after editing the Variant group in Akeneo V. 1.3.

Unfortunately I'm a little lost: is there a way to get from an Pim\Bundle\CatalogBundle\Entity\Group

attribute value? Is there some other better way to get these Variant values ​​that have been edited?

I can't even find out which table the attribute values ​​are stored in MySQL (I just found pim_catalog_product_value

for product values).

+3


source to share


1 answer


Yes, it is not easy to understand in this part.

Variant group values ​​are not saved in the same way as product values.

These group version values ​​are used only for copying in related products and are stored in the product template.

From the product template you can get the values ​​normalized to json with

$group->getProductTemplate()->getValuesData()`.

      



You can take a look at the ProductTemplateApplier and ProductTemplateUpdater to see how we apply the group values ​​for products (the json format can be used almost directly using the product updater).

When we edit a variant group to be able to use the same form as for a product, we use a subscriber TransformProductTemplateValuesSubscriber

.

It denormalizes json values ​​to product value objects with

$this->denormalizer->denormalize($data->getValuesData(), 'ProductValue[]', 'json');`

      

Do not hesitate if you need more information.

+8


source







All Articles