true,
'connection_timeout' => 86400,
'wsdl_cache' => WSDL_CACHE_NONE,
);
$proxy = new SoapClient('https://www.veromotos.com.br/index.php/api/v2_soap/?wsdl=1',$options);
try {
echo "
";
$sessionId = $proxy->login('example', 'example123@');
echo "
";
}catch(Exception $e) {
die(var_dump($e));
}
/**
* Simple product
#1 (sku : SKU-001)
*/
$productData = array(
'name' => 'Produto Simples
#1',
'description' => 'Descrição do Produto Simples
#1',
'short_description' => 'Descrição Curta do Produto Simples
#1',
'website_ids' => array('base'), // Id or code of website
'status' => 1, // 1 = Enabled, 2 = Disabled
'visibility' => 1, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search
'tax_class_id' => 2, // Default VAT
'weight' => 0,
'stock_data' => array(
'use_config_manage_stock' => 0,
'manage_stock' => 0, // We do not manage stock, for example
),
'price' => 9.90, // Same price than configurable product, no price change
'additional_attributes' => array(
'single_data' => array(
array(
'key' => 'cores',
'value' => 'AMARELO', // Id or label of color, attribute that will be used to configure product
),
),
),
);
$proxy->catalogProductCreate($sessionId, 'simple', 'Default', 'SKU-001', $productData);
/**
* Simple product
#2 (sku : SKU-002)
*/
$productData = array(
'name' => 'Produto Simples
#2',
'description' => 'Descrição do Produto Simples
#2',
'short_description' => 'Descrição Curta do Produto Simples
#2',
'website_ids' => array('base'), // Id or code of website
'status' => 1, // 1 = Enabled, 2 = Disabled
'visibility' => 1, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search
'tax_class_id' => 2, // Default VAT
'weight' => 0,
'stock_data' => array(
'use_config_manage_stock' => 0,
'manage_stock' => 0, // We do not manage stock, for example
),
'price' => 8.90, // Red product is $1 less than configurable product
'additional_attributes' => array(
'single_data' => array(
array(
'key' => 'cores',
'value' => 'AZUL', // Id or label of color, attribute that will be used to configure product
),
),
),
);
// Creation of product
#2
$proxy->catalogProductCreate($sessionId, 'simple', 'Default', 'SKU-002', $productData);
/**
* Configurable product
*/
$productData = array(
'name' => 'Produto Configurável',
'description' => 'Descrição do produto configurável',
'short_description' => 'Descrição curta do produto configurável',
'website_ids' => array('base'), // Id or code of website
'status' => 1, // 1 = Enabled, 2 = Disabled
'visibility' => 4, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search
'tax_class_id' => 2, // Default VAT
'weight' => 0,
'stock_data' => array(
'use_config_manage_stock' => 0,
'manage_stock' => 0, // We do not manage stock, for example
),
'price' => 9.90,
'associated_skus' => array('SKU-001', 'SKU-002'), // Simple products to associate
);
try {
$proxy->catalogProductCreate($sessionId,'configurable','Default','Configurable Product',$productData);
}catch(Exception $e) {
echo "
";
die(var_dump($e));
echo "
";
}
I'm receiving the following error: ["previous":"Exception":private]=>
NULL
["faultstring"]=>
string(92) "Call to undefined method Mage_Catalog_Model_Product_Attribute_Backend_Price::getAllOptions()"
["faultcode"]=>
string(15) "SOAP-ENV:Server"
}