如何使用 SOAP v2 从 Magento 中提取所有产品及其属性
经过三天偶尔卓有成效的研究后,我能够从 Magento 网站上获取一系列产品,并获取特定产品的额外属性,但我确实需要所有产品及其属性的完整转储。 因此,这适用于单个产品:
$sku='HHAM-6';
$attributes = new stdClass();
$attributes->attributes = array('description', 'short_description', 'price');
$list = $client->catalogProductInfo($session, $sku, NULL, $attributes,'');
print_r($list);
这适用于获取所有产品的基本信息:
$params = '';
$result = $client->catalogProductList($session, $params);
print_r($result);
那么我如何融合两者?后者的输出包括:
[product_id] => 1
[sku] => HHAM-6
如何集成每个产品的第一个例程?某种 foreach 构造?
抱歉,如果这太明显了,但欢迎任何帮助。
蒂姆
After three days of occasionally fruitful headbanging I am able to pull a collection of products off a Magento website and obtain the extra attributes for a specific product, but I really need a full dump of all products and their attributes.
So this works for an individual product:
$sku='HHAM-6';
$attributes = new stdClass();
$attributes->attributes = array('description', 'short_description', 'price');
$list = $client->catalogProductInfo($session, $sku, NULL, $attributes,'');
print_r($list);
and this works to get the basic info on all products:
$params = '';
$result = $client->catalogProductList($session, $params);
print_r($result);
So how do I meld the two? The output of the latter includes:
[product_id] => 1
[sku] => HHAM-6
How do I then integrate the first routine for each product? Some kind of foreach construct?
Sorry if this is too obvious but any assistance welcome.
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
API 方法
catalogProductList
始终仅返回下一个属性:请参阅 \app\code\core\Mage\Catalog\Model\Product\Api\V2.php 第 82 行(或附近的某个位置)。
您可以使用
catalogProductList
获取所有产品的数组,然后使用catalogProductInfo
对其进行foreach并获取每个产品的属性。但为什么不进入管理并使用系统->导入/导出->导出并将所有产品导出到 csv 呢?API method
catalogProductList
always return only next attributes:See \app\code\core\Mage\Catalog\Model\Product\Api\V2.php line 82 (or somewhere around it).
You can get array of all products with
catalogProductList
and then foreach it and get attributes for each product withcatalogProductInfo
. But why not go to admin and use System->Import/Export->Export and export all products to csv?对于 SOAP v1,我在 /app/code/core/Mage/Catalog/Model/Product/Api.php 第 108 行找到了它
For SOAP v1 I found it in /app/code/core/Mage/Catalog/Model/Product/Api.php line 108