magento2-link-product icon indicating copy to clipboard operation
magento2-link-product copied to clipboard

Need modification for Bulk Import since Magento 2.4.1

Open 0-Sony opened this issue 3 years ago • 4 comments

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 type

if you take a look on this class : \Magento\CatalogImportExport\Model\Import\Product

you will see this from line 225 :

    /**
     * Links attribute name-to-link type ID.
     *
     * @deprecated 101.1.0 use DI for LinkProcessor class if you want to add additional types
     *
     * @var array
     */
    protected $_linkNameToId = [
        '_related_' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED,
        '_crosssell_' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL,
        '_upsell_' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL,
    ];

Regards.

0-Sony avatar Jan 21 '21 10:01 0-Sony