What is options_container in Magento Core API?

You would notice there’s a field named options_container when you retrieve the information of a product by the product.info Magento API call. It is either ‘container1‘ or ‘container2‘.

What is it? What does it do?

It’s essentially a part of the product page layout, prescribing where the custom options of the product would be displayed. Typically, ‘container1‘ is up in the page near the price while ‘container2‘ is a bit down the page around the description area where horizontal rows are plenty. But this all depends on the theme being used.

What are msrp_enabled, msrp_display_actual_price_type and msrp in Magento API?

When you are playing with the product.info API of Magento to acquire the information of a specific product, you may scratch your head and wonder, what are these 3 fields and what do they do:

  1. msrp_enabled
  2. msrp_display_actual_price_type
  3. msrp

After trying and feeding test values to some of the fields in the Price tab of Product Information page (product editing page) in the administrator control panel, I finally found what these meant:

  1. msrp_enabled = Apply MAP (Minimum Advertised Price)
  2. msrp_display_actual_price_type = Display Actual Price
  3. msrp = Manufacturer’s Suggested Retail Price

Weird? Another case advocating terminology consistency in documentation.

In most cases, sticking to the default values would be fine. So before you are creating a product by the product.create API, use product.info to see what the default values are when the product is created from the administrator control panel.

Magento API SoapClient Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn’t load from…

I was just trying to make the Magento Core API web service to work so I could write my own automated scripts to perform scheduled manipulations on the entire database (products, attributes, categories, customers, etc.) of my Magento store. And when I tried the example here to list some of the products, it gave me this SoapClient error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.example.com/api/soap/?wsdl' : Extra content at the end of the document in \www\mapi.php:4 Stack trace: #0 \www\mapi.php(4): SoapClient->SoapClient('http://www.exam...') #1 {main} thrown in \www\mapi.php on line 4

Did some searches and finally solved the problem. What you need to do is to first download the WSDL file from your Magento installation with cURL and then open it with SoapClient rather than download the file with SoapClient.

This is the modified PHP code from the official example:

$curl = curl_init('http://www.example.com/api/soap/?wsdl');
curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);

$wsdl_string = curl_exec($curl);

file_put_contents('temp.xml',$wsdl_string);

try
{
	$proxy = new SoapClient('temp.xml');
	$sessionId = $proxy->login('yourApiUser', 'yourApiKey');

	$filters = array(
		'sku' => array('like'=>'%')
	);

	$products = $proxy->call($sessionId, 'product.list', array($filters));

	var_dump($products);

}
catch (Exception $e)
{
	print '<pre>';
	var_dump(libxml_get_last_error());
	print '</pre>';
}

Just change ‘www.example.com’, ‘yourApiUser’ and ‘yourApiKey’ to your own.