Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mark 122 posts 255 karma points
    Jan 08, 2015 @ 15:23
    Mark
    0

    MTNP nodes not being found on import, version 2.5.1

    I'm running an import of products and my destination node has 3 Multi Node Tree Pickers for associated items. There's one for associated products, one for linked product ranges and one for linked market sectors.

    Bizzarely, only the associated products import is working, but for the other two MNTPs, it is putting in the parent node name, and the other it is putting in the parents parent node name. Not sure if there's any significance to that.

    I have added a couple of extra text properties to accept what I'm trying to import to the MNTPs and the import is putting in the expected values. Nodes do exist at the selected locations with the correct names, so that's not the issue.

    All 3 MNTPs are set up identically, just with different starting nodes and the XPath filter with the appropriate node aliases in (/*[self::ProductDetail], /*[self::ProductRange], /*[self::ProductSector] respectively). Each is a Node Picker, not an XPath expression. Each can have a maximum of 20 nodes, minimum of 0 and is stored as a csv.

    Any thoughts from anyone? Hoping I'm just missing something simple, maybe asking will force me to find it myself!

    Thanks,

    Mark

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 08, 2015 @ 17:18
    Richard Soeteman
    0

    Hi Mark,

    It's because CMSImport handles the xpath a bit different than normal. This is because the node doesn't always know the location up front. So it tries to find the first node with the name and that node will be used. Works 90% of the time but not in your scenario now. Maybe you can change to root location?

    Best,

    Richard

  • Mark 122 posts 255 karma points
    Jan 08, 2015 @ 17:48
    Mark
    0

    Ok, so I need to use XPath to find the root node, then allow only selection of the correct node type? I don't use XPath often at all, aside from the standard /*[self::NodeTypeAlias], so not sure what I'm doing to get to that level from the root..

    If my structure is as follows:

    Content (Root)
    --Home (DocTypeAlias "Dashboard")
    ----Products (DocTypeAlias "Products")
    ------Product Ranges (DocTypeAlias "ProductRanges")
    --------Product Range (DocTypeAlias "ProductRange")
    ------Product Sectors (DocTypeAlias "ProductSectors")
    --------Product Sector (DocTypeAlias "ProductSectors")
    ------Product Detail (DocTypeAlias "ProductDetail)
    ----[Other Nodes...]

    What is the XPath expression to get all "ProductRange" nodes under the "ProductRanges" node? I believe I need to start with "$currentPage/ancestor-or-self::root", just not sure of the syntax to drill down to the correct level and isolate the right node type to enable.

    Thanks for the response..

    Mark

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 08, 2015 @ 17:53
    Richard Soeteman
    0

    Hi Mark,

    I always have the same issue ;-) But usually I play a bit and then it starts working. What you also can try is to specify a root id then this id will be respected during import.

    Best,

    Richard

  • Mark 122 posts 255 karma points
    Jan 08, 2015 @ 17:55
    Mark
    0

    Ok, typical...  Think I have the correct XPath worked out:

    /*[ancestor-or-self::root /descendant::ProductSector]

    Just running the import again to see if that fixes the issue..

    Mark

  • Mark 122 posts 255 karma points
    Jan 09, 2015 @ 10:48
    Mark
    0

    So, after many tries with different XPaths, nothing has changed. The above path displays the correct nodes in the MNTP, but CMS Import is still not finding the nodes? Could it be anything else other than just the XPath?

    Like I said, the values being entered are "Products" for the Product Range MNTP and "Home" for the Product Sector MNTP. This is the same for every product, the range is always imported as "Products" which it doesn't match and the sector is always "Home", again which doesn't match. Both MNTPs are using the same XPath, just with different descendant nodes:

    /*[ancestor-or-self::root /descendant::ProductRange]
    &
    /*[ancestor-or-self::root /descendant::ProductSector]

    So I would expect them to either both always enter "Products" or "Home", not one of each, as neither matches any of the ranges or sectors.

    Any other thoughts would be appreciated, I'm a little stumped? As each import is taking between 7 - 10 mins, the trial and error process is very lengthy..

    Thanks for the help so far,

    Mark

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 09, 2015 @ 10:59
    Richard Soeteman
    0

    You could try to write your own Field Provider. I do that most of the time for complex tasks I need to do for customers http://www.richardsoeteman.net/2013/12/05/FieldProvidersInCMSImport25.aspx

  • Mark 122 posts 255 karma points
    Jan 09, 2015 @ 12:55
    Mark
    0

    Ok, so I've resigned myself to creating a Field Provider, but..

    I have created a very simple one for the MNTP  with the MNTPs GUID:

    [FieldProvider(PropertyEditorAlias = "7e062c13-7c41-4ad9-b389-41d88aeef87c", Priority = FieldProviderPrio.Low)]

    I have set it to low priority as I wanted to see exactly what CMS import was getting first out of curiosity. When running through the debugger, on hitting my Field Provider, it would appear that CMS Import has indeed found the correct nodes and the value parameter contains the correct node Id(s). The property parameter however has a different wrong value.

    Based on that, I have told my Field Providor to just return the value parameter as that is already correct and there's no point in me doing unneccessary logic. However, the correct values are still not being entered.. Do I need anything else other than the parse method?

    public object Parse(object value, Property property, FieldProviderOptions fieldProviderOptions)
    {
    // value seems to always be correct when debugging, where as property.Value is wrong and clearly the value being saved to the database.
    return value;
    }

    Mark

  • Mark 122 posts 255 karma points
    Jan 09, 2015 @ 15:05
    Mark
    1

    Ok.. So it turns out it wasn't CMS Import all along... or the XPath or anything else..

    After much digging around and head scratching, I discovered an old event triggered by a ProductDetail node save that was overriding the properties with parent folder values! I'm migrating this site to a new more suitable structure so it was a hangover from that.  Very frustrating, but at least I have learned a few things on the way.

    Thanks for the help!

    Mark

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 12, 2015 @ 07:51
    Richard Soeteman
    0

    Ah events yes always nice ;-)

Please Sign in or register to post replies

Write your reply to:

Draft