【问题标题】:Is it possible to link to an existing product image using the Magento Soap API V2?是否可以使用 Magento Soap API V2 链接到现有产品图像?
【发布时间】:2012-05-17 14:34:50
【问题描述】:
我正在使用 Magento 提供课程注册。我正在使用 SOAP API V2 将类“克隆”到新日期。
我想重新使用现有的班级图像,因为重复上传相同的图像数百次似乎很愚蠢。
是否可以通过 API V2 链接到现有图像?
catalogProductAttributeMediaCreate() 似乎不想按照我的尝试来做。
catalogProductAttributeMediaUpdate() 也不起作用,因为尚未为该产品创建图像。
【问题讨论】:
标签:
image
api
magento
soap
【解决方案1】:
试试这个。
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
$result = $proxy->catalogProductAttributeMediaInfo($sessionId, '2', '/b/l/blackberry8100_2.jpg');
var_dump($result);
回复:
array
'file' => string '/b/l/blackberry8100_2.jpg' (length=25)
'label' => string '' (length=0)
'position' => string '1' (length=1)
'exclude' => string '0' (length=1)
'url' => string 'http://magentohost/media/catalog/product/b/l/blackberry8100_2.jpg' (length=71)
'types' =>
array
0 => string 'image' (length=5)
1 => string 'small_image' (length=11)
2 => string 'thumbnail' (length=9)