Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Module: Complex Product API

Resource: product_custom_option

Method:
  • product_custom_option.list (SOAP V1)
  • catalogProductCustomOptionList (SOAP V2)

Allows you to retrieve the list of custom options for a specific product.

Arguments:

TypeNameDescription
stringsessionIdSession ID
stringproductIdProduct ID
stringstoreStore view ID or code (optional but required for WS-I mode)

Return:

TypeNameDescription
arrayresultArray of catalogProductCustomOptionList

The catalogProductCustomOptionList content is as follows:

TypeNameDescription
stringoption_idCustom option ID
stringtitleCustom option title
stringtypeCustom option type
stringsort_orderCustom option sort order
intis_requireDefines whether the custom option is required

Faults:

Fault CodeFault Message
101Product with requested id does not exist.
104Store with requested code/id does not exist.

Examples

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

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

$result = $client->call($session, 'product_custom_option.list', '1');
var_dump($result);

// If you don't need the session anymore
//$client->endSession($session);
Request Example SOAP V2
$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->catalogProductCustomOptionList($sessionId, '1');
var_dump($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));

$result = $proxy->catalogProductCustomOptionList((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'store' => '1'));
var_dump($result->result);
Response Example SOAP V1
array
  0 =>
    array
      'option_id' => string '1' (length=1)
      'title' => string 'model' (length=5)
      'type' => string 'drop_down' (length=9)
      'is_require' => string '1' (length=1)
      'sort_order' => string '0' (length=1)