Invalid Value for ‘Attribute’ When Creating Product Programmatically in Magento

create-productimportproductproduct-attribute

When creating a product programmatically using the method described here, what format does the value need to be in for a Yes/No attribute type? (note: my attribute is global)

So far I have tried the following values for my Yes/No field:
0 and 1
1 and 2
'0' and '1'
'1' and '2'

So far all I am getting is the error "Invalid value for 'myAttributeName'"

I have scoured Google but somehow can't find an example of someone creating a product in this way where a Yes/No type attribute was used.

Note: I will test other values such as true false, 'Yes' 'No', and -1 0 and update question shortly.

Best Answer

Well it turns out that the values need to be formatted as:
'Yes' or 'No' (including quotation marks / denoting a string)

Note:this is probably also dependant on the language being used for your store.

Related Topic