Developer forum

Forum » Integration » Delete missing groups in ecomprovider

Delete missing groups in ecomprovider

Anders Ebdrup
Anders Ebdrup
Reply

Hi Dynamicweb,

 

When importing product data with the Ecomprovider, then "Delete missing groups" has no effect when the groups are specified with the "groups" tag in EcomProducts-section.

For now it only adds groups to the productgroup-relation and not discards non-existing groups in the import.

 

Can this be changed?

 

Best regards, Anders


Replies

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply

Hi Anders,

Which version is in play here? And maybe a URL as well.

BR
Morten

 
Anders Ebdrup
Anders Ebdrup
Reply

It is DW 9

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply

Is that 9.1.1 or 9.3? :-)

/Morten

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Morten,

 

I have had a look in the latest version in TFS and can see this code snippet:

//Find groups, create if missing, add relations   
                    string groups = GetValue(mapping.GetColumnMappings().Find(cm => cm.DestinationColumn.Name == "Groups"), row);
                    if (!string.IsNullOrEmpty(groups))
                    {
                        try
                        {
                            string groupSorting = GetValue(mapping.GetColumnMappings().Find(cm => cm.DestinationColumn.Name == "GroupSorting"), row);
                            groupSorting = (groupSorting == null) ? string.Empty : groupSorting;
                            string primaryGroup = GetValue(mapping.GetColumnMappings().Find(cm => cm.DestinationColumn.Name == "PrimaryGroup"), row);
                            primaryGroup = (primaryGroup == null) ? string.Empty : primaryGroup;

                            TextReader sorting = new StringReader(groupSorting);
                            CsvReader sortingreader = new CsvReader(sorting, false);
                            sortingreader.ReadNextRecord();
                            TextReader input = new StringReader(groups);
                            CsvReader reader = new CsvReader(input, false);
                            reader.ReadNextRecord();
                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                string group = reader[i];
                                if (sortingreader.FieldCount > i)
                                {
                                    AddGroupReferenceToProduct(productID, productLanguageID, group, sortingreader[i], primaryGroup);
                                }
                                else
                                {
                                    AddGroupReferenceToProduct(productID, productLanguageID, group, "0", primaryGroup);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("Write failed. Reason: " + ex.Message, ex);
                        }
                    }

 

And here groups are only added and not removed if not set.

 

//Anders

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Anders,
there was a feature like that, see tfs# 19825, so missed group product relations should be deleted. The code for that is:
if (deleteExcess && isGroupsColumnInMapping && HasRowsToImport(productsMapping, out groupProductRelationTempTablePrefix))
            {
                DeleteExcessFromGroupProductRelation(shop, sqlTransaction);
            }
It is run when the "Remove missing rows after import" option is selected.
You can try that in the last Dynamicweb.DataIntegration.Providers.EcomProvider 1.0.20 package.
Regards, Dmitrij

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Dmitrij,

 

Will this work when we are working with partial updates of products?

 

Best regards, Anders

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Anders,
As I understand partial update is a case when multiple xml files are being imported to the same Ecom destination table? If yes, then it should work, as this operation is run when reading information from all source files is finished.
Regards, Dmitrij

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Dmitrij,

 

By partial, I mean updating only some of the products and not all of then

//Anders

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Anders,
The missed group-product relations will be removed, there is no functionality to remove the relations for only the products from the import.

There was something seems you are asking about "Partial update", but it was in Dynamicweb provider, tfs# 13244.
Regards, Dmitrij

 
Anders Ebdrup
Anders Ebdrup
Reply

By changin to the Dynamicwebprovider I am going to miss some other functionality. Is it possible to have this option added to the Ecomprovider?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Yes, will be added in TFS# 38607

 
Anders Ebdrup
Anders Ebdrup
Reply

Sounds great! Thank you, Dmitrij! :-)

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Anders

The feature #38607 to Add PartialUpdate functionality from Dynamicweb to Ecom provider has been implementet in Package "Dynamicweb.DataIntegration.Providers.EcomProvider" version 1.0.21

You are able to find this update in the backend Package update section.

Also this is part of the 9.3.2 release 

You are able to find this build in the download section:

http://doc.dynamicweb.com/releases-and-downloads/releases

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum