【问题标题】:Magento webservice API Product optionsMagento 网络服务 API 产品选项
【发布时间】:2011-12-20 16:05:44
【问题描述】:

我在 Magento 网络服务 API 的文档中进行了搜索,但找不到获取特定产品变体/选项的选项。例如,我有一只鞋,想知道用户可以选择哪些鞋码。是否有可能获得这些值?

提前致谢!

【问题讨论】:

    标签: web-services api magento


    【解决方案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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多