TransWikia.com

Handle several collections of children items on data import

Sitecore Asked on September 25, 2020

I managed to import the data with Parent-Child relations (below you can see that I have several pipelines for different types of items – red for parent; green for subfolder; blue for children). However, I need to have children of different templates under the parent (Folder Assets on the image below).

enter image description here

I thought that I can try to extend the second Pipeline like below:

1.Select Languages

2.Resolve Product Model

3.Apply Mapping

4.Update Sitecore Item

5.Get Product Folders

6.Iterate Product Folders

7.Get Asset Folders (use another property of a parent object)

8.Iterate Asset Folders (pointer to a new pipeline which will handle Assets)

However, this solution doesn’t work (it seems that If we changed the context to a child pipeline in step 6 then we can’t go back to step 7). Do you have any suggestions how to setup the pipeline batch to reach the goal?

Thank you in advance for the help.

2 Answers

Solution 1

Override SetObjectOnPipelineContext method ofCopyObjectFromContextToNewLocationStepProcessor with

 public class MyCopyObjectToNewLocation : DataExchange.Processors.PipelineSteps.CopyObjectFromContextToNewLocationStepProcessor
{

    public override bool SetObjectOnPipelineContext(object obj, Guid location, PipelineContext pipelineContext, ILogger logger)
    {

        if (location == ItemIDs.PipelineContextIterableData)
        {
            var plugin = this.GetPipelineContextPlugin<IterableDataSettings>(pipelineContext, false);
            if (plugin != null)
            {
                pipelineContext.RemovePlugin(typeof(IterableDataSettings));
            }

            plugin = new IterableDataSettings(obj as IEnumerable);
            this.AddPluginToPipelineContext(plugin, pipelineContext, false);
            return true;
        }

        return base.SetObjectOnPipelineContext(obj, location, pipelineContext, logger);
    }
}

Find __Standard Values of Copy Object from Context to New Location Pipeline Step template and update Process Type with your fix.

Verify that pipeline steps created on this template were updated.

Solution 2

Solution 1 is hint where problem is. There is an issue with itarable data location. Certainly for this location it checks if it's already set then skip it. It means the next using of this location in the current pipeline will never assign new object to Pipeline Context Iterable Data location.

As workaround you can use Pipeline Context Temp Storage instead of Pipeline Context Iterable Data

Correct answer by Vlad Shpak on September 25, 2020

I have similar requirement, i wanted to create child category items under the product. I used above 'Vlad' inputs and added pipeline step 'Get Catalog item'.

As mentioned in the below image for resolve category child item, I set 'Parent for item location' as 'Pipeline Context Parent Target', it helps me to create child categories under product.

enter image description here

Answered by Sivalingaamorthy on September 25, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP