如何获得在Magento中使用SOAP的制造商列表?

时间:2014-03-25 21:50:01

标签: php magento soap

我正在尝试通过SOAP列出Magento中的所有制造商名称和ID,但我找不到代码示例来执行此操作。任何人都可以帮助如何使用SOAP和PHP实现这一目标吗?

2 个答案:

答案 0 :(得分:0)

我建议你看看这篇文章,它展示了如何轻松使用Magento SOAP Web服务https://www.wsdltophp.com/Blog/Use-WsdlToPhp-to-manage-your-Magento-website-with-its-SOAP-API

答案 1 :(得分:0)

您应该可以使用Product Attributes API执行此操作。文档链接http://www.magentocommerce.com/api/soap/catalog/catalogProductAttribute/product_attribute.info.html

下面的代码应该为您提供一个属性以及与之关联的值。您只需传入属性代码即可。然后从响应对象中提取options值,该值应包含一个catalogAttributeOptionEntity数组,它将是您的选项和值。

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

// If somestuff requires api authentification,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

$result = $client->call($session, 'product_attribute.info', 'manufacturer');
var_dump ($result);

// If you don't need the session anymore
//$client->endSession($session);
相关问题