导入失败,显示”具有ID x的导入/导出配置文件只能用于导入”。

huangapple go评论76阅读模式
英文:

Import fails with "The import/export profile with id x can only be used for import"

问题

我们使用的是Shopware 6.5.2.1中标记为“import”的配置文件进行产品导入。

但我们收到以下消息:

具有id x的导入/导出配置文件只能用于导入

在导入被挂起处理的同时。我们有一个错误(文件中的重复产品编号),但在配置文件仅设置为“import”时,错误报告并不正确。

这是否是正常行为还是一个错误?

我们猜测Shopware在内部也尝试导出数据,以用于错误报告?

备注:问题不是关于导入文件中提到的错误 - 我们知道我们可以通过将匹配列设置为“productNumber”而不是“id”来解决“重复产品编号”的问题。

英文:

We did a product Import with a profile which is only marked as "import" in Shopware 6.5.2.1

Still we get the message

The import/export profile with id x can only be used for import

In the message consumer while the import is stuck on processing.
We have an error (duplicate productNumber in the file) - but this is not properly reported in the case the profile is set only to "import".

Is this normal behavior or a bug?

We assume that Shopware internally tries to also export the data, to use it for the error report?

Remark: The question is not about the above mentioned error in the import file - we know we can fix the "duplicate product number" problem by setting the matching column to productNumber instead of id.

答案1

得分: 1

We assume that Shopware internally tries to also export the data, to use it for the error report?
是的,就是这样。 我认为这可以被视为一个错误,请您报告一下吗?

If it's urgent you can patch it for the time being:
如果很紧急,您可以暂时修复它:

diff --git a/src/Core/Content/ImportExport/Service/ImportExportService.php b/src/Core/Content/ImportExport/Service/ImportExportService.php
--- a/src/Core/Content/ImportExport/Service/ImportExportService.php	(revision d832807a8e3a4e7e4cfc922e18fdf7bb8d386ac9)
+++ b/src/Core/Content/ImportExport/Service/ImportExportService.php	(date 1687804790920)
@@ -51,7 +51,10 @@
     ): ImportExportLogEntity {
         $profileEntity = $this->findProfile($context, $profileId);
 
-        if (!\in_array($profileEntity->getType(), [ImportExportProfileEntity::TYPE_EXPORT, ImportExportProfileEntity::TYPE_IMPORT_EXPORT], true)) {
+        if (
+            !\in_array($profileEntity->getType(), [ImportExportProfileEntity::TYPE_EXPORT, ImportExportProfileEntity::TYPE_IMPORT_EXPORT], true)
+            && $activity !== ImportExportLogEntity::ACTIVITY_INVALID_RECORDS_EXPORT
+        ) {
             throw a ProfileWrongTypeException($profileEntity->getId(), $profileEntity->getType());
         }
英文:

> We assume that Shopware internally tries to also export the data, to use it for the error report?

Yes, that's it. I think this can be considered a bug, could you report it please?

If it's urgent you can patch it for the time being:

diff --git a/src/Core/Content/ImportExport/Service/ImportExportService.php b/src/Core/Content/ImportExport/Service/ImportExportService.php
--- a/src/Core/Content/ImportExport/Service/ImportExportService.php	(revision d832807a8e3a4e7e4cfc922e18fdf7bb8d386ac9)
+++ b/src/Core/Content/ImportExport/Service/ImportExportService.php	(date 1687804790920)
@@ -51,7 +51,10 @@
     ): ImportExportLogEntity {
         $profileEntity = $this->findProfile($context, $profileId);
 
-        if (!\in_array($profileEntity->getType(), [ImportExportProfileEntity::TYPE_EXPORT, ImportExportProfileEntity::TYPE_IMPORT_EXPORT], true)) {
+        if (
+            !\in_array($profileEntity->getType(), [ImportExportProfileEntity::TYPE_EXPORT, ImportExportProfileEntity::TYPE_IMPORT_EXPORT], true)
+            && $activity !== ImportExportLogEntity::ACTIVITY_INVALID_RECORDS_EXPORT
+        ) {
             throw new ProfileWrongTypeException($profileEntity->getId(), $profileEntity->getType());
         }

huangapple
  • 本文由 发表于 2023年6月26日 16:31:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76554914.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定