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: Vendor/Magento/CatalogImportExport/Model/Import/Product.php
/**
* Links attribute name-to-link type ID.
*
* @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,
'_required_' => \StackExchange\RequiredProduct\Model\Product\Link::LINK_TYPE_REQUIRED,
'_consumable_' => \StackExchange\AdditionalItems\Model\Product\Link::LINK_TYPE_CONSUMABLE,
'_recommended_' => \StackExchange\AdditionalItems\Model\Product\Link::LINK_TYPE_RECOMMENDED,
'_optional_language_arts_' => \StackExchange\AdditionalItems\Model\Product\Link::LINK_TYPE_OPTIONAL_LANGUAGE_ARTS,
'_fivedays_also_includes_' => \StackExchange\AdditionalItems\Model\Product\Link::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.
I have followed below link but no luck
https://github.com/magepal/magento2-link-product
My CSV format looks like this: