Open 0-Sony opened 3 years ago
@0-Sony ... thanks for reporting this issue.
Can you try this solution and let me know if it works?
In app/code/MagePal/LinkProduct/etc/di.xml
add
<type name="Magento\CatalogImportExport\Model\Import\Product\LinkProcessor">
<arguments>
<argument name="linkNameToId" xsi:type="array">
<item name="_accessory_" xsi:type="const">MagePal\LinkProduct\Model\Product\Link::LINK_TYPE_ACCESSORY</item>
</argument>
</arguments>
</type>
Let me know so I can release a new version
Hi @srenon ,
you would need also to add new key/value in this array \Magento\CatalogImportExport\Model\Import\Product::$_fieldsMap
You need to add a new Model Type in import.xml and use customFieldsMapping
method.
Check this class \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
it's used here $this->_fieldsMap = array_merge($this->_fieldsMap, $model->getCustomFieldsMapping());
line 1236 in \Magento\CatalogImportExport\Model\Import\Product
Regards
@0-Sony ... This going to take a while for me to get set up and figure out. Since you already have a handle on this you are more than welcome to create a Pull Request and I will merge it in.
Hello,
I've got the same issue on same magento version.
I've simply overrided Class Magento\CatalogImportExport\Model\Import\Product througth di.xml to add :
in $_linkNameToId : '_accessory_' => \MagePal\LinkProduct\Model\Product\Link::LINK_TYPE_ACCESSORY,
in $_fieldsMap : '_accessory_sku' => 'accessory_skus', '_accessory_position' => 'accessory_position',
And it's working fine on v2.4.1 CE.
Regards,
Magento version : 2.4.1
Edition (EE, CE, OS, etc): CE, EE
Expected behavior: bulk import works
Actual behavior: can't bulk import accessory product link type
Steps to reproduce:
Just import a csv file using the out of the box bulk import feature
Preconditions
Magento 2.4.1 php 7.4
Hi Magepal,
Currently working on Magento 2.4.1, you would need to update your module in order to make it working with this new Magento version. The current patch needed for the import that you provide don't work anymore since the codebase has changed in Magento Core.
I suggest that you need to make a plugin to this method
\Magento\CatalogImportExport\Model\Import\Product\LinkProcessor::addNameToIds
in order to add your accessory product typeif you take a look on this class :
\Magento\CatalogImportExport\Model\Import\Product
you will see this from line 225 :
Regards.