Попробуйте этот патч, если вы уже создали новый тип отношений в вашем модуле.
Проверено на версии Magento 2.3.1
diff --git a/vendor/magento/module-catalog-import-export/Model/Import/Product.php b/vendor/magento/module-catalog-import-export/Model/Import/Product.php
index dc9d219..0e19ef8 100644
--- a/vendor/magento/module-catalog-import-export/Model/Import/Product.php
+++ b/vendor/magento/module-catalog-import-export/Model/Import/Product.php
@@ -226,6 +226,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
'_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,
+ '_custom_related_' => \vendor\Module\Model\Product::LINK_TYPE_CUSTOM_RELATED,
];
/**
@@ -334,6 +335,8 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
'min_sale_qty' => 'min_cart_qty',
'max_sale_qty' => 'max_cart_qty',
'notify_stock_qty' => 'notify_on_stock_below',
+ '_custom_related_sku' => 'custom_related_sku',
+ '_custom_related_position' => 'custom_related_position',
'_related_sku' => 'related_skus',
'_related_position' => 'related_position',
'_crosssell_sku' => 'crosssell_skus',
@@ -1257,7 +1260,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
$nextLinkId = $this->_resourceHelper->getNextAutoincrement($mainTable);
// pre-load 'position' attributes ID for each link type once
- foreach ($this->_linkNameToId as $linkName => $linkId) {
+ foreach ($this->getLinkNameToId() as $linkName => $linkId) {
$select = $this->_connection->select()->from(
$resource->getTable('catalog_product_link_attribute'),
['id' => 'product_link_attribute_id']
@@ -1292,7 +1295,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
$linkKey = "{$productId}-{$linkData['linked_id']}-{$linkData['link_type_id']}";
$productLinkKeys[$linkKey] = $linkData['id'];
}
- foreach ($this->_linkNameToId as $linkName => $linkId) {
+ foreach ($this->getLinkNameToId() as $linkName => $linkId) {
$productIds[] = $productId;
if (isset($rowData[$linkName . 'sku'])) {
$linkSkus = explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'sku']);
@@ -2333,6 +2336,16 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
}
/**
+ * Attribute set ID-to-name pairs getter.
+ *
+ * @return array
+ */
+ public function getLinkNameToId()
+ {
+ return $this->_linkNameToId;
+ }
+
+ /**
* DB connection getter.
*
* @return \Magento\Framework\DB\Adapter\AdapterInterface