Magento 2产品导入不会导入图像

时间:2016-04-01 17:15:58

标签: magento2 magento2.0.2

我使用内置的CSV导入(系统 - 导入 - 产品)导入产品

我的所有数据都输入正常,但是我收到了错误消息 Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in rows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

在我的CSS中,我将base_image路径写为 http://mywebsite.ca/pub/media/import/img/hose/jpg/Ach7938.jpg

作为测试我删除了我的文件夹结构,编辑了csv并尝试了这个并得到了同样的问题,同样的错误 http://mywebsite.ca/pub/media/import/Ach7938.jpg

我尝试编写文件路径 /pub/media/import/img/hose/jpg/Ach7938.jpg 但它不会让我通过“检查数据”验证器。

我确认文件夹和文件的权限是775

我使用的是php 5.6,我试过7但它以多种不同的方式打破了整个网站,所以这不是一个选项

作为旁注,如果我连续运行20次,整个站点都会挂起,导入将无法再次运行,直到我进行完整的系统还原(最新情况?)

我可以将图像放在不同的服务器上并以这种方式链接到它们吗?

3 个答案:

答案 0 :(得分:0)

需要相对于magento Images File Directory设置doc root

例如,如果您的商品图片位于pub/media/catalog/product

将其设为Images File Directory

答案 1 :(得分:0)

图像路径可以是相对路径或简单名称。我都导入了它,并且有效。就我而言,问题是在路径中给定的图像在文件夹中不可用。我尝试导入可用和不可用的图像,但是在该图像不可用时出现错误。 路径可以是任何路径,不必仅使用border:2px solid rgba(191, 191, 191, .25)

答案 2 :(得分:0)

对于导入图像问题,我已经修复了Uploader.php文件中的问题。更改以下文件路径代码并成功导入图像。

  

文件路径:   magento / vendor / magento / module-catalog-import-export / Model / Import / Uploader.php

Find the below line from line number 201:
  

$ filePath = $ this-> _ directory-> getRelativePath($ filePath。$ fileName);

Replace with:
  

$ filePath = strpos($ filePath,$ fileName)!==否?   $ filePath:$ this-> _ directory-> getRelativePath($ filePath。$ fileName);

有关更多信息,请参见github链接:

https://github.com/magento/magento2/pull/20761/commits/8612789375b0c173f0ba852c587882af6ff8bc7f