I changed how 3.1 imports grouped and single products from excel.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
I changed how 3.10 imports grouped and single products.

Excel Import File
For single product's that are associated with a grouped product, you can now specify the unique SKU of the parent grouped product instead of the numeric ID.  This keeps everything dynamic.

Example:

NIKE-GSERIES instead of number 18

The following variable was changed from int to string.

string parentGroupedProductId = Convert.ToString(worksheet.Cells[iRow, GetColumnIndex(properties, "ParentGroupedProductId")].Value);


Now in your excel import file you can specify the unique SKU of the parent group instead of it's ID.

The following code checks the parentGroupedProductId from the excel file for 0 (no parent) or the parents unique SKU.

//does this record have a parent group specified? 0 means no parent group, while anything else is a unique SKU
if (parentGroupedProductId != "0")
{
//since the parent group SKU was specified let's get the parent group ID
//example of unique SKU for parent group: NIKE-GSERIES-GROUP (I like to append -GROUP at the end)
var parentGroupProduct = _productService.GetProductBySku(parentGroupedProductId);
//associate the current product with the following parent group product
product.ParentGroupedProductId = parentGroupProduct.Id;
}
else
{
//do not associate this product with any group product
product.ParentGroupedProductId = 0;
}          
    

I have to modify the export code to specify the unique SKU of the parent instead of it's parent ID.

Now the import and export process for single products associated with a group is completely dynamic instead of using hard coded numeric parent id's.  This works great for new products and updating of existing products.

Any problems let me know.

SAMPLE EXCEL IMPORT FIELDS

ProductTypeID - ParentGroupProductID - SKU
10 (Grouped Product) / 0 / NIKE-GSERIES-GROUP
5 (Single Product) / NIKE-GSERIES-GROUP / NIKE-GSERIES-RED
5 (Single Product) / NIKE-GSERIES-GROUP / NIKE-GSERIES-BLUE
10 years ago
im still confused .. if i saw the excel file example of say 1 group product and 2 associated products would help
10 years ago
Hi,

This is exactly what I am looking for, has this change been released?

Many thanks

Brett
10 years ago
I have had an export routine written to export my ebay listings, which I now have upgrade to support the new nop 3.1 structure and to cater with parent product ids. Pre 3.1 the import process was using the SKU (correct me if I am wrong) to detect parent SKU's and link them. Now it is using ParentProductId, which, when I generate an export file, there is no way of knowing this ID and therefore unable to link SKUs.

The suggestion given here is good but requires core code changes, and from past experience I rather not make these changes if I can avoid it. Reason is when upgrading Nop versions, the code needs to be merged and just creates an extra overhead when upgrading.

Does Nop have any plans to include this as standard functionality in future releases? Anyone have any other alternatives?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.