Magento API v1-一次通话即可列出所有产品的价格 [英] Magento API v1- List prices for all products in one call
问题描述
我有以下代码:
$filters = array('sku' => array('like'=>'%'));
$items = $magConn->call($sessionID, 'product.list', array($filters));
这将返回所有产品及其sku,描述和数量的数组.但是,我还需要获取价格吗?有没有办法得到它?
This will return an array of all the products and their sku, description, and qty. However, I also need to get the price? Is there a way to get that as well?
我也有这个工作,
$properties = ($magConn->call($sessionID, 'product.info', $item['sku']));
,它将返回一种产品的所有属性.我有2,000多种产品,如果我想在今晚结束,那绝对是不可行的.;)
which will return all the attributes for one product. I've got over 2,000 products, and this is definitely not feasible if I want it to end tonight. ;)
推荐答案
如果不修改magento源代码,就没有办法.您应该转到 \ app \ code \ core \ Mage \ Catalog \ Model \ Product \ Api.php
,在 items()
方法内找到下一行:
No way without magento source code modification. You should go to \app\code\core\Mage\Catalog\Model\Product\Api.php
, find next lines inside items()
method:
$result[] = array( // Basic product data
'product_id' => $product->getId(),
'sku' => $product->getSku(),
'name' => $product->getName(),
'set' => $product->getAttributeSetId(),
'type' => $product->getTypeId(),
'category_ids' => $product->getCategoryIds()
);
并在此处添加价格.
这篇关于Magento API v1-一次通话即可列出所有产品的价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!