Magento webservice API产品选项

时间:2011-12-20 16:05:44

标签: web-services api magento

我在Magento webservice API的文档中搜索,但找不到获取特定产品的变体/选项的选项。例如,我有一双鞋,想知道用户可以选择哪种鞋号。是否有可能获得这些价值?

提前致谢!

1 个答案:

答案 0 :(得分:1)

对于Magento SOAP API V1,您可以这样做:

$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', '11');
var_dump ($result);

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

您将通过选项列表获得有关所需属性的完整信息。


示例回复:

array
  'attribute_id' => string '11' (length=3)
  'attribute_code' => string 'new_special_price' (length=17)
  'frontend_input' => string 'text' (length=4)
  'default_value' => null
  'is_unique' => string '0' (length=1)
  'is_required' => string '0' (length=1)
  'apply_to' =>
    array
      empty
  'is_configurable' => string '0' (length=1)
  'is_searchable' => string '0' (length=1)
  'is_visible_in_advanced_search' => string '0' (length=1)
  'is_comparable' => string '0' (length=1)
  'is_used_for_promo_rules' => string '0' (length=1)
  'is_visible_on_front' => string '0' (length=1)
  'used_in_product_listing' => string '0' (length=1)
  'frontend_label' =>
    array
      0 =>
        array
          'store_id' => int 0
          'label' => string 'special price' (length=13)
      1 =>
        array
          'store_id' => int 2
          'label' => string 'special price' (length=13)
  'scope' => string 'store' (length=5)
  'additional_fields' =>
    array
      'frontend_class' => null
      'is_html_allowed_on_front' => string '1' (length=1)
      'used_for_sort_by' => string '0' (length=1)
  

source