Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PropertyValues depreciated in V3 #341

Open
Woland2k opened this issue Apr 1, 2020 · 1 comment
Open

PropertyValues depreciated in V3 #341

Woland2k opened this issue Apr 1, 2020 · 1 comment
Assignees
Labels

Comments

@Woland2k
Copy link
Contributor

Woland2k commented Apr 1, 2020

I can see that PropertyValues was depreciated for the CatalogProduct class in V3:

        [Obsolete("it's for importing data from v.2, need to use values in Properties")]
        public ICollection<PropertyValue> PropertyValues { get; set; }

So what is the way to just add values to the product without necessary creating corresponding property?

@tatarincev
Copy link
Contributor

tatarincev commented Apr 9, 2020

So to change a property value for the product you need to use the product.properties collection instead

product.Properties.FirstOrDefault(x => x.Name.EqualsInvariant("color"))?.Values = new [] { new PropertyValue { Value = "foo" }; 

We need to add some better fluent syntax to do that from code, I'll create some task into our internal backlog.

Ween need to do it something like this

product.Properties["color"] = "foo";
product.Properties["some_array"] = new [] { "foo", "boo" };
product.Properties["some_dict"] = new PropertyDictionaryItem { ... }
product.Properties["some_flag"] = true
product.Properties["some_datetime"] = DateTime.UtcNow();
product.Properties["some_muti_lang"] = new LocalizedString { Lang = "en-US", Value = "red" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants