The price property is using a Vendr property editor with a specific data structure and so the importers will likely need to know how to import those values. With CMS Import I think that can be handled via a custom FieldAdapter which would contain the logic to convert the single csv value into the specific data structure.
Here, the Guid object keys are the ID's of Vendr Currencies. In your FieldAdapter you could lookup whatever is the default currency for a store and just assign the value to that currency.
You'll probably need to ask in the CMS Import form for more info on how to implement a FieldAdapter.
Speaking with Richard, we may look to create a Vendr add-on package to encapsulate all of this as it would be really handy for others too, however this won't be available immediately so a custom FieldProvider would be the only option currently.
I'm not 100% sure myself as I haven't looked into how CMS Import works but my guess is that it might need the value returning in the expected raw format, which for the Vendr Price property will be a JSON serialized string of the data structure I gave earlier so it might need to be something like
var price = Decimal.Parse(value.AsString());
var data = new Dictionary<string, decimal> {
{ "6FD40872-83A8-473E-9DE4-F1305049F8D9", price }
};
return JsonConvert.SerializeObject(data);
Given the known data structure, it might be best asking on the CMS Import forums about specific implementation as like I say, I haven't done this myself yet, as I'm just repeating their docs to you atm.
Import Price Value
Hi there,
I have set up my Vendr Store following the instructions from Paul Seals Tutorial:
How to build an eCommerce site in Umbraco using Vendr
Now I tried to import Products using the Umbraco Packages: CMSIMPORT and a second, fairly new package, CSV Import
All values are imported apart from the Price (decimal)
I have tried to change the format in my CSV import file to all sort of formats without success.
There is no error. The Price field just stays empty.
Any ideas?
Hi Edgar,
The price property is using a Vendr property editor with a specific data structure and so the importers will likely need to know how to import those values. With CMS Import I think that can be handled via a custom FieldAdapter which would contain the logic to convert the single csv value into the specific data structure.
The data structure of a price field is:
Here, the Guid object keys are the ID's of Vendr Currencies. In your FieldAdapter you could lookup whatever is the default currency for a store and just assign the value to that currency.
You'll probably need to ask in the CMS Import form for more info on how to implement a FieldAdapter.
Ok, just checked the CMS Import docs here https://soetemansoftware.nl/media/60883/cmsimport-manual.pdf and it looks like it's now called a
FieldProvider
. You can find documentation on how to implement one yourself in page 25.Speaking with Richard, we may look to create a Vendr add-on package to encapsulate all of this as it would be really handy for others too, however this won't be available immediately so a custom
FieldProvider
would be the only option currently.Hi Matt,
thanks for your reply.
I have now tried to set up the class like so:
Unfortunately I have no idea how to handle the bit where it says: //EXAMPLE CODE PLEASE
Could you point in the right direction please?
Thank you
Hi Edgar,
I'm not 100% sure myself as I haven't looked into how CMS Import works but my guess is that it might need the value returning in the expected raw format, which for the Vendr Price property will be a JSON serialized string of the data structure I gave earlier so it might need to be something like
Given the known data structure, it might be best asking on the CMS Import forums about specific implementation as like I say, I haven't done this myself yet, as I'm just repeating their docs to you atm.
Matt
Thank you Matt.
I have now shifted the issue to the CMS Import forum.
Hopefully someone can help out.
No problem
I've subscribed to the other topic so I'll follow along and see if I can't offer any input if there is something Vendr specific required.
Matt
is working on a reply...