diff --git a/app/code/Mage/ImportExport/Model/Import/Entity/Product.php b/app/code/Mage/ImportExport/Model/Import/Entity/Product.php index 9cf9de8f593c9..46dc4ff9812b0 100644 --- a/app/code/Mage/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Mage/ImportExport/Model/Import/Entity/Product.php @@ -746,6 +746,19 @@ protected function _saveLinks() } else { $linkedId = $this->_oldSku[$linkedSku]['entity_id']; } + + if ($linkedId == null) { + // Import file links to a SKU which is skipped for some reasons -> leads to a "NULL" + // link causing fatal errors. + Mage::logException( + new Exception( + sprintf('WARNING: Orphaned link skipped: From SKU %s (ID %d) to SKU %s, Link type id: %d', + $sku, $productId, $linkedSku, $linkId) + ) + ); + continue; + } + $linkKey = "{$productId}-{$linkedId}-{$linkId}"; if (!isset($linkRows[$linkKey])) {