0

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.

  • 1
    You should be fine using true or false. – Adarsh Khatri Apr 30 '15 at 3:37
5

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.

  • And this is on a default Magento product yes/no attribute or a select? BY the way, thank you for returning and answering your question – Sander Mangel Apr 30 '15 at 6:15
0

It is dependant to the language in Backend.

If the shop is in german language for example than the value has to be Ja or Nein.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.