简体   繁体   English

使用magento soap API获取最新产品

[英]get latest products using magento soap API

i'm trying to get the latest products (max 20) from magento API using SOAP, i only need the images and the product link, as they are being displayed on another site. 我正在尝试使用SOAP从magento API获取最新产品(最多20个),我只需要图像和产品链接,因为它们正显示在另一个站点上。

i'm using the below code to do that: 我正在使用下面的代码来做到这一点:

$client = new SoapClient('http://magentohost/api/soap/?wsdl');

$session = $client->login('username', 'password');

$apicalls = array();
$i = 0;
$ii = 0;

$filters = array('sku' => array('neq'=>''));

$products = $client->call($session, 'catalog_product.list',array($filters));

foreach ($products as $product){
    $apicalls[$i] = array('catalog_product_attribute_media.list', $product['product_id']);
    $i++;
    $apicalls[$i] = array('catalog_product.info', $product['product_id']);
    $i++;
}

$productinfo = $client->multiCall($session, $apicalls);

however the above code is not displaying the images, any ideas?? 但是上面的代码没有显示图像,有什么想法吗?

Thanks for the help 谢谢您的帮助

this code works, My bet is you don't have Product Images selected in Role settings. 此代码有效,我敢打赌,您没有在“角色设置”中选择“产品图片”。 Please check it and let me know. 请检查并告知我。

Web Service -> SOAP/XML-RPC - Roles -> Role Resources Web服务-> SOAP / XML-RPC-角色->角色资源

From tree navigate and check: 从树中导航并检查:

Catalog -> Product -> Product Images 目录->产品->产品图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM