akeneo / magento2-connector-community

Akeneo Connector for Magento 2
Open Software License 3.0
83 stars 89 forks source link

Imported Configurable Products have has_options = and required_options = 0 even if options exist #324

Open jurvi opened 3 years ago

jurvi commented 3 years ago

Environment and configuration

Akeneo 3.2 CE Magento 2.4.1 with PWA Studio frontend in magento-cloud, PHP 7.4

Steps to reproduce

  1. Import product models / variants from Akeneo to Magento
  2. Try to fetch an imported Configurable Product using GraphQL "products"

Expected result

Configurable product should get returned

Actual result

Out of stock message basically meaning that no products found using url_key.

I have tried to debug this somewhat already, and at least there is a clear issue with catalog_product_entity.has_options and catalog_product_entity.required_options being set to false during import, even if the configurable product does have options. If I open the product in Magento admin, change something e.g weight, and save the product, it actually works, and at least has_options and required_options are set to true now in DB and it gets returned with the GraphQL request as well. There is clearly some kind of issue with how Configurable Products are imported, but so far I havent been able to come up with a proper fix.

So far I tried setting catalog_product_entity.has_options and catalog_product_entity.required_options to 1 for configurable products that have children using the DB connection in the linkConfigurable step. I also tried to add another step before dropTable where I basically just fetch & resave the configurable products using ProductRepository, but did not seem to fix it either.

Dnd-Gimix commented 3 years ago

Hello @jurvi,

Thank you for your interest in Akeneo Connector. We actually did a fix for this issue in the version 100.4.12 of the connector : https://github.com/akeneo/magento2-connector-community/releases/tag/v100.4.12. (see the "createEntities" function of the Job/Product.php class)

Do you have this version of the connector or greater ? If not, could please update it ?

Thank you ! Regards,

jurvi commented 3 years ago

Hello @jurvi,

Thank you for your interest in Akeneo Connector. We actually did a fix for this issue in the version 100.4.12 of the connector : https://github.com/akeneo/magento2-connector-community/releases/tag/v100.4.12. (see the "createEntities" function of the Job/Product.php class)

Do you have this version of the connector or greater ? If not, could please update it ?

Thank you ! Regards,

Hi @Dnd-Gimix,

We are currently running 101.2.0 so this fix should already by in, but this issue is still happening. Just now I checked database and last night we had some new configurable products created with the connector, and same issue:

MariaDB [xxxxxxxxx]> select * from catalog_product_entity where sku like '%XXX%'; +-----------+------------------+--------------+---------+-------------+------------------+---------------------+---------------------+--------+------------+------------+ | entity_id | attribute_set_id | type_id | sku | has_options | required_options | created_at | updated_at | row_id | created_in | updated_in | +-----------+------------------+--------------+---------+-------------+------------------+---------------------+---------------------+--------+------------+------------+ | 9087 | 28 | configurable | XXX | 0 | 0 | 2021-03-23 03:45:09 | 2021-03-25 03:46:41 | 9089 | 1 | 2147483647 | +-----------+------------------+--------------+---------+-------------+------------------+---------------------+---------------------+--------+------------+------------+ 1 row in set (0.002 sec)

And after I open this product once in the admin UI, change weight, save it, those fields get properly updated:

MariaDB [3o5htaao7gick]> select * from catalog_product_entity where sku like '%XXX%'; +-----------+------------------+--------------+---------+-------------+------------------+---------------------+---------------------+--------+------------+------------+ | entity_id | attribute_set_id | type_id | sku | has_options | required_options | created_at | updated_at | row_id | created_in | updated_in | +-----------+------------------+--------------+---------+-------------+------------------+---------------------+---------------------+--------+------------+------------+ | 9087 | 28 | configurable | XXX | 1 | 1 | 2021-03-23 03:45:09 | 2021-03-25 12:10:21 | 9089 | 1 | 2147483647 | +-----------+------------------+--------------+---------+-------------+------------------+---------------------+---------------------+--------+------------+------------+ 1 row in set (0.002 sec)

jurvi commented 3 years ago

I tried reviewing the changes in 100.4.12 and I didn't really understand what part there should have helped with this issue. They are now not explicitly set to 0 anymore, but there is no logic to actually set them to 1 either when necessary.