I am using umbrco 6.1.2 and latest version of cmsimport. I have a spreadsheet with 100 products each product has features. I have imported list of each feature using cms import. My product has mntp pickers for each feature the values are stored as csv and you can only have one value. I have imported small subset of products however the features do not map so i just get empty value for mntp fields. I thought latest cmsimport supported mntp? Or do i need to write a field adaptor?
I know you find the answer already but a quick reply for future reads.
MNTP is supported for media indeed in CMSImport.In your case you are using normal content references so you need to write a FieldAdapter to achieve this goal.
LogHelper.Info(typeof(MntpAdapter), () => string.Format("doing lookup nodeid {0} in value {1}", lookUpNodeId, propertyValue));
var node = uQuery.GetNode(lookUpNodeId).ChildrenAsList.FirstOrDefault(n => n.Name.ToLower() == value.ToLower());
if (node != null && !string.IsNullOrEmpty(node.Name))
{
value = node.Id.ToString();
}
else
{
LogHelper.Info(typeof(MntpAdapter), () => string.Format("no value found doing lookup nodeid {0} in value {1} for property {2}", lookUpNodeId, propertyValue, property));
In the 2.4 release of CMSImport. Lookups for MNTP are supported. CMSImport will find the rootnode where to look for items based on the datatype configuration of the Multi node tree picker. When a match is found on Name(not case sensitive), or id it will be mapped to MNTP during import. You can also assign comma separated values during import to map multiple items.
We have a MNTP for a collection of people (Contacts). Within that we had an a - z node container for organization. Is there a way upon import to look inside each of those node conatiners for the actual node value? Right now, it does not match b/c it is only look at the level immediately below the "Collection Of People" which is essentially the a - z node containers.
I've fixed this last week for a client who used filters. Release is not fully tested yet therefore it's not yet available. Care to test? If so mail me please [email protected].
Is the lookup functionality working in Umbraco 7 in CMSImport 2.5.1? I believe I have everything correctly configured. I have some MultiNodeTreePickers on a content I'm importing and all mapped properties are imported except those which are MNTPs. The datasource contains values which exist in the content tree in the MNTP Node Type. I can't seem to find what I'm doing wrong. Can you help please?
MNTP Node Type should work as expected. But for V7 there are a few changes. Can you share how you configured MNTP Then I can reproduce and fix the issue.
Working on it now. Seems that there was a new MNTP where I thought the other picker was already multi node. Sorry for the confusion it will be in the next version tho.
Latest version with MNTP
Hello,
I am using umbrco 6.1.2 and latest version of cmsimport. I have a spreadsheet with 100 products each product has features. I have imported list of each feature using cms import. My product has mntp pickers for each feature the values are stored as csv and you can only have one value. I have imported small subset of products however the features do not map so i just get empty value for mntp fields. I thought latest cmsimport supported mntp? Or do i need to write a field adaptor?
Regards
Ismail
Hi Ismail,
I know you find the answer already but a quick reply for future reads.
MNTP is supported for media indeed in CMSImport.In your case you are using normal content references so you need to write a FieldAdapter to achieve this goal.
Thanks,
Richard
Richard,
Yup some code below for anyone interested need to ensure that all the pages that referenced via mntp are published:
public class MntpAdapter : IFieldAdapter
{
private static readonly Dictionary<string,int> LookUp = new Dictionary<string, int>();
public MntpAdapter()
{
if (LookUp.Count == 0)
{
LookUp.Add("MNTP Chemical resistance picker (1,1)",1066);
LookUp.Add("MNTP Fabric Picker (1,1)", 1127);
LookUp.Add("MNTP Max Temp picker (1,1)", 1063);
LookUp.Add("MNTP Min Temp picker (1,1)", 1060);
LookUp.Add("MNTP Polymer picker (1,1)", 1126);
LookUp.Add("MNTP Tensile Strength (1,1)", 1074);
LookUp.Add("MNTP Thickness picker (1,1)", 1057);
LookUp.Add("MNTP Weight picker (1,1)", 1054);
LogHelper.Info(typeof(MntpAdapter), () => "initialised lookup dictionary for field adapter");
}
}
public Guid DataTypeId
{
get { return new Guid("7e062c13-7c41-4ad9-b389-41d88aeef87c"); } //guid of mntp type that all my datatypes are based on
}
public object Parse(object value, umbraco.cms.businesslogic.property.Property property, FieldAdapterOptions fieldAdapterOptions)
{
if (LookUp.ContainsKey(property.PropertyType.DataTypeDefinition.Text))
{
try
{
value = GetLookUpValue(LookUp[property.PropertyType.DataTypeDefinition.Text], value.ToString(),
property.PropertyType.DataTypeDefinition.Text);
}
catch (Exception ex)
{
LogHelper.Error(typeof(MntpAdapter), "doing lookup " + ex.ToString(), ex);
}
}
return value;
}
/// <summary>
/// translate the option to previously imported data and get id
/// so mntp will work
/// </summary>
/// <param name="lookUpNodeId"></param>
/// <param name="value"></param>
/// <param name="property"></param>
/// <returns></returns>
private string GetLookUpValue(int lookUpNodeId, string value,string property)
{
string propertyValue = value;
LogHelper.Info(typeof(MntpAdapter), () => string.Format("doing lookup nodeid {0} in value {1}", lookUpNodeId, propertyValue));
var node = uQuery.GetNode(lookUpNodeId).ChildrenAsList.FirstOrDefault(n => n.Name.ToLower() == value.ToLower());
if (node != null && !string.IsNullOrEmpty(node.Name))
{
value = node.Id.ToString();
}
else
{
LogHelper.Info(typeof(MntpAdapter), () => string.Format("no value found doing lookup nodeid {0} in value {1} for property {2}", lookUpNodeId, propertyValue, property));
value = string.Empty;
}
return value;
}
}
Thanks for sharing!
Hi Ismail and others,
In the 2.4 release of CMSImport. Lookups for MNTP are supported. CMSImport will find the rootnode where to look for items based on the datatype configuration of the Multi node tree picker. When a match is found on Name(not case sensitive), or id it will be mapped to MNTP during import. You can also assign comma separated values during import to map multiple items.
Hope this helps,
Richard
Richard,
That is mint!!! Awesome work.
Thanks!
Hi Richard,
We have a MNTP for a collection of people (Contacts). Within that we had an a - z node container for organization. Is there a way upon import to look inside each of those node conatiners for the actual node value? Right now, it does not match b/c it is only look at the level immediately below the "Collection Of People" which is essentially the a - z node containers.
Example:
- Contacts
- A
- Adam
- Alice
- B
- C
- ...etc.
Trying to get a match on Adam and Alice.
Thanks,
Ed
Hi Ed,
I've fixed this last week for a client who used filters. Release is not fully tested yet therefore it's not yet available. Care to test? If so mail me please [email protected].
Thanks,
Richard
Awesome - Thanks Richard. Email sent.
Hi Richard
Is the lookup functionality working in Umbraco 7 in CMSImport 2.5.1?
I believe I have everything correctly configured. I have some MultiNodeTreePickers on a content I'm importing and all mapped properties are imported except those which are MNTPs. The datasource contains values which exist in the content tree in the MNTP Node Type. I can't seem to find what I'm doing wrong. Can you help please?
Thanks in advance
Hi Philipe,
MNTP Node Type should work as expected. But for V7 there are a few changes. Can you share how you configured MNTP Then I can reproduce and fix the issue.
Thanks,
Richard
Hi Richard
Thanks for your reply. My MNTP configuration is pretty straightforward:
Property Editor:
Multinode Treepicker
Node type:
Content
I've choosen a root node using the content tree, not xpath.
Filter:
None
Minimum/maximum number of items:
None
Thanks
Filipe
I eventually got a workaround using a FieldProvider.
Working on it now. Seems that there was a new MNTP where I thought the other picker was already multi node. Sorry for the confusion it will be in the next version tho.
is working on a reply...