I have one website and one store. When I add product from admin, with some programatically added attributes (for example in table catalog_product_entity_int
), they get store_id 0 (adminhtml
). Is that ok?
Has it some negative consequences if later I want to add some store views for some other languages?
1 Answer
This is normal behavior. Store id 0 means "default values".
When retrieving a value for an attribute, Magento does something like this.
Do I have a value for the current store view id.?
- Yes: I use that.
- No: Do I have a value for the store view id 0?
- Yes: I use that
- No: Use
null
.
So if you later add other store views and add values for those store views, they value for store id 0 will be ignored.
-
Thank you, that is clear now. But what in case of select/multiselect attributes? In my store they have different labels for admin store (0) and default frontend view (1) for every option. I bind values and products searching for admin labels, but I noticed that
id
of value just exists two times for both store views, so I think it is no difference if I search for value basing on store0
or1
. Am I right? Sep 9, 2016 at 6:46 -
-
I have select/multiselect attribute with options added. Options have different labels for store view
1
and0
. If I want to add value for product programatically is it any difference if I search foroption_id
. Is it any difference if I search foradmin
orfrontend
label? Both labels have the sameoption_id
. Sep 9, 2016 at 7:15 -
if you want to add one for store id 1, you should replace the existing one, if you want to add one for store id 2, just added. If you want to replace the default value replace the one for 0. Do not add 2 values for the same store view id. I don't think you are even allowed to do that.– Marius ♦Sep 9, 2016 at 7:25
-
I mean that different labels of the same options are separated, but they still have the same
option_id
. Sep 9, 2016 at 8:09