frontend-label not defined magento API V2
-
13-12-2019 - |
Question
I'm getting an error: "Frontend-label not defined". This is my call:
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient('http://magentosite/api/v2_soap?wsdl=1', array('cache_wsdl' => WSDL_CACHE_NONE));
$session = $client->login('*****', '*****');
$result = $client->catalogProductAttributeCreate($session, array(
'attribute_code' => 'nieuw_code',
'frontend_input' => 'select',
'scope' => 'global',
'apply_to' => array(
'simple', 'configurable'
),
'is_configurable' => '1',
'is_visible_in_advanced_search' => '1',
'is_visible_on_front' => '1',
'additional_fields' => array(
'key' => 'color',
'value' => 'red'
),
'frontend_label' => array(
'store_id' => 'default', <-- tried numerous things here already
'label' => 'Default' <-- tried numerous things here already
),
));
var_dump($result);
In the API docs is this: "Notes: The "label" value for the "store_id" value set to 0 must be specified. An attribute cannot be created without specifying the label for store_id=0."
But I don't get what they mean with that?
Solution
Try this :
$AttributeData = array(
"attribute_code" => "nieuw_code",
"frontend_input" => "select",
"scope" => "global",
"default_value" => "1",
"is_unique" => 0,
"is_required" => 0,
"apply_to" => array("simple","configurable"),
"is_configurable" => 1,
"is_searchable" => 0,
"is_visible_in_advanced_search" => 1,
"is_comparable" => 0,
"is_used_for_promo_rules" => 0,
"is_visible_on_front" => 1,
"used_in_product_listing" => 0,
"additional_fields" => array(),
"frontend_label" => array(
array("store_id" => "0", // store id or store code
"label" => "Nieuw Code" // attribute lable here
)
) //
);
$result = $client->catalogProductAttributeCreate($session, $AttributeData);
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange