Magento Api 对于很多产品来说太慢

发布于 2024-09-23 23:56:00 字数 195 浏览 4 评论 0原文

我需要您的建议,我目前正在使用 Magento API 在 Magento 管理(magento 数据库)中导入产品,我注意到它真的太慢了​​。添加 1000 个产品大约需要 1 小时,而且我必须添加近 260,000 个产品。

我怎样才能加快这个过程?是否有任何替代流程可以解决此问题?

感谢您的任何建议或答复!

里查·维尔马

I need your suggestions please, I'm currently using the Magento API for importing products in Magento admin (magento database), and I have noticed that it's really too slow. It's taking approximately 1 hr to add 1000 products, and I have to add almost 260,000 products.

How can I speed up the process? Is there any alternative process to resolve this issue?

Thanks for any suggestion or answer!

Richa verma

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

把回忆走一遍 2024-09-30 23:56:00

加快此过程的唯一方法就是不使用 api。正如您所发现的,对于此类任务来说,速度太慢了。

相反,您必须直接使用数据库(以获得最大速度),但不幸的是,这要求您在非常低的水平上完全理解 Magento 如何处理插入产品以及在此过程中涉及的所有表。

中间解决方案可能是使用 magento 模型等来创建这些产品。例如,要创建一个新的简单产品,您可以使用此类代码:

$newProduct = Mage::getModel('catalog/product')
        ->setAttributeSetId($attributeSetId)
        ->setTypeId('simple')
        ->setStatus(1)
        ->setTaxClassId(2)
        ->setVisibility(4)
        ->setSku($sku)
        ->setName($name)
        ->setDescription($description)
        ->setShortDescription($shortDescription)
        ->setPrice($price)
        ->save();

这是一个非常简单的示例,您可以在此处执行更多操作。

我使用了类似的方法和自定义模块从 csv 文件导入产品,需要几个小时才能导入大约 1500 个产品。

我认为,尽管考虑到您所谈论的数量,那么您决定将这些产品引入 Magento 的任何方式都将需要很长时间。我还想问为什么你首先需要这么多产品。

The only way to speed up this process would be to simply not use the api. As you have come to find, it is far too slow for this type of task.

Instead, you will have to work directly with the database ( for maximum speed ), but unfortunately this requires you to fully understand at a very low level how Magento deals with inserting products and all of the tables that are touched in this process.

An intermediate solution may be to use the magento models etc. to create these products. For example to create a new simple product you can use this type of code:

$newProduct = Mage::getModel('catalog/product')
        ->setAttributeSetId($attributeSetId)
        ->setTypeId('simple')
        ->setStatus(1)
        ->setTaxClassId(2)
        ->setVisibility(4)
        ->setSku($sku)
        ->setName($name)
        ->setDescription($description)
        ->setShortDescription($shortDescription)
        ->setPrice($price)
        ->save();

This is a very simple example and there is so much more you can do here.

I have used a similar method with a custom module for importing products from csv files and it takes a few hours to import around 1500 products.

I think though that with the volumes you are talking about then any way you decide to get these products into Magento is going to take a long time. I would also question why you need so many products in the first place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文