We have created custom link types like consumable, recommended, etc like cross-sells, upsells, related.
Now we would like to implement the import functionality for these custom types. We have written below code on vendor file (Magento/CatalogImportExport/Model/Import/Product.php)
so that while import custom link types are working as expected.
File Path is: Vendor/Magento/CatalogImportExport/Model/Import/Product.php
/**
* Links attribute name-to-link type ID.
*
* @var array
*/
protected $_linkNameToId = [
'_related_' => MagentoCatalogModelProductLink::LINK_TYPE_RELATED,
'_crosssell_' => MagentoCatalogModelProductLink::LINK_TYPE_CROSSSELL,
'_upsell_' => MagentoCatalogModelProductLink::LINK_TYPE_UPSELL,
'_required_' => StackExchangeRequiredProductModelProductLink::LINK_TYPE_REQUIRED,
'_consumable_' => StackExchangeAdditionalItemsModelProductLink::LINK_TYPE_CONSUMABLE,
'_recommended_' => StackExchangeAdditionalItemsModelProductLink::LINK_TYPE_RECOMMENDED,
'_optional_language_arts_' => StackExchangeAdditionalItemsModelProductLink::LINK_TYPE_OPTIONAL_LANGUAGE_ARTS,
'_fivedays_also_includes_' => StackExchangeAdditionalItemsModelProductLink::LINK_TYPE_FIVEDAYS_ALSO_INCLUDES
];
/**
* Map between import file fields and system fields/attributes.
*
* @var array
*/
protected $_fieldsMap = [ ......
.......
'_required_sku' => 'required_skus',
'_consumable_sku' => 'consumable_skus',
'_recommended_sku' => 'recommended_skus',
'_optional_language_arts_sku' => 'optional_language_arts_skus',
'_fivedays_also_includes_sku' => 'fivedays_also_includes_skus'
];
Now I would like to override and add my data from my custom module. Can anyone guide and provide me the steps, please. Magento 2.3.1 Version
My CSV format looks like this: