akeneo / magento2-connector-community

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

The categories are not importing #436

Open LukaszZabielskiMonogo opened 2 years ago

LukaszZabielskiMonogo commented 2 years ago

Environment and configuration

  1. Akeneo connector tag 102.0.0
  2. Akeneo version 5.0.46 CE
  3. Magento B2B 2.4.2-p1

Steps to reproduce

  1. Try to import categories

Expected result

  1. Categories import successful

    Actual result

  2. Create and update category entities SQLSTATE[42S22]: Column not found: 1054 Unknown column 'p.row_id' in 'field list', query was: INSERT INTO `catalog_category_entity` (`entity_id`, `attribute_set_id`, `parent_id`, `updated_at`, `path`, `position`, `level`, `children_count`, `row

image

LukaszZabielskiMonogo commented 2 years ago

Problem it was a Magento 2 B2B table structure, i make plugin and added necessary column to tmp_akeneo_connector_entities_category table. Next, modification is in vendor/akeneo/module-magento2-connector-community/Job/Category.php, method createEntities(). This line of code solved my issue $values['row_id'] = 'IFNULL (row_id, _entity_id)'; Now, I thinking how to override and fix this method without hard ovverides this class.

mhenni commented 2 years ago

Hello, can I have more details on the resolution. I have the same issue. Thank you

LukaszZabielskiMonogo commented 2 years ago

@mhenni

  1. First make the plugin in your module, and make system configuration:

`/**

` <field id="magento_b2b" translate="label comment" type="select" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0">

                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                <comment>Magento 2 B2B Edition Compatibility</comment>
            </field>
        </group>`
  1. Make the preference for file:

<preference for="Akeneo\Connector\Job\Category" type="Vendor\VendorName\Job\Category" />

Override this function: public function createEntities() Add this line of code (original file line number 602):

if ($this->helperData->getCnfIsMagentoB2B()) { $values['row_id'] = 'IFNULL (row_id, _entity_id)'; }

Before:

/** @var \Magento\Framework\DB\Select $parents */ $parents = $connection->select()->from( $tmpTable, $values );

sad270 commented 2 years ago

Hello, I rollback to version 101.6.1 and category import seems working to me on this version.

Dnd-Gimix commented 2 years ago

Hello @sad270 @mhenni @LukaszZabielskiMonogo ,

Thank you for reaching to us.

It seems that your issue is caused by the version 101.7.0 (https://github.com/akeneo/magento2-connector-community/releases/tag/v101.7.0) adding support for Magento 2 category staging, but we are unable to replicate the issue on our side with our settings.

Are you all using Magento 2 B2B modules?

@LukaszZabielskiMonogo : Problem it was a Magento 2 B2B table structure Do you have any details to help us resolve the issue? Did you find the root cause?

The "p.row_id" is supposed to be added in the select by the "addJoinForContentStagingCategory" function which is working well for us, so there must be a corner case that is currently not handled by the connector.

Many thanks.

Regards,