akeneo / magento2-connector-community

Akeneo Connector for Magento 2
Open Software License 3.0
88 stars 90 forks source link

Configurable products mapping creates new column instead of updating. #181

Open JoostWan opened 4 years ago

JoostWan commented 4 years ago

Environment and configuration

  1. Akeneo version: 3.2.10
  2. Magento version 2.3.4
  3. Akeneo connector version: 100.4.2

Steps to reproduce

  1. Added mapping for configurable product. In the case we want to use the Akeneo attribute conf_name for the Magento attribute name.

Screenshot 2020-04-09 at 10 38 10

  1. Run the product import.

Expected result

Configurable product uses the value of conf_name and simple products used default value from Akeneo attribute name.

Actual result

Configurable product uses the value of conf_name and simple products has a empty name.

Debugging

I checked the code and the table _tmp_akeneo_connector_entitiesproduct. In our database the column name was name-nl_NL-ecommerce. When the sync was ready and the config mapping was enabled for name there was a new column with name-nl_NL. This column had the correct values for config products. But was empty for simple products. So the mapping function creates a new column instead of updating the correct column (name-nl_NL-ecommerce) with the new value.

Fixed it for now with this so ecommerce is added to the column name.

https://github.com/akeneo/magento2-connector-community/blob/master/Job/Product.php#L852

$mapping = $value . '-' . substr($column, $pos + 1) . '-' . $this->scopeConfig->getValue(ConfigHelper::AKENEO_API_ADMIN_CHANNEL);

sumil3890 commented 2 years ago

Hello @JoostWan

Environment and configuration

  1. Akeneo version: 3.2.10
  2. Magento version 2.3.4
  3. Akeneo connector version: 100.4.2

Steps to reproduce

  1. Added mapping for configurable product. In the case we want to use the Akeneo attribute conf_name for the Magento attribute name.

Screenshot 2020-04-09 at 10 38 10

  1. Run the product import.

Expected result

Configurable product uses the value of conf_name and simple products used default value from Akeneo attribute name.

Actual result

Configurable product uses the value of conf_name and simple products has a empty name.

Debugging

I checked the code and the table _tmp_akeneo_connector_entitiesproduct. In our database the column name was name-nl_NL-ecommerce. When the sync was ready and the config mapping was enabled for name there was a new column with name-nl_NL. This column had the correct values for config products. But was empty for simple products. So the mapping function creates a new column instead of updating the correct column (name-nl_NL-ecommerce) with the new value.

Fixed it for now with this so ecommerce is added to the column name.

https://github.com/akeneo/magento2-connector-community/blob/master/Job/Product.php#L852

$mapping = $value . '-' . substr($column, $pos + 1) . '-' . $this->scopeConfig->getValue(ConfigHelper::AKENEO_API_ADMIN_CHANNEL);

How did you solve this issue ?