Skip to main content
simply more productive

The Data Specialist

Thanks to our intuitive transformation designer, you can convert data effortlessly to a variety of formats without knowing how to program. It’s not only efficient, it’s also easy to use.
Flowheater Download

Import Bundle Items

More
7 years 3 months ago #2959 by JD Cox
Import Bundle Items was created by JD Cox
We have a customer that’s planning to offer bundled items on the site over the holidays. They did this last year but manually added the list of items to the import file.

I would like them to leave the bundle item on the file and let us (FH) remove/replace the bundle item and add the list of items from a SS we’ll maintain.

Order item qty
100 X101 2
100 X200 1
100 B101 2

During the import is it possible to replace the B101 (bundle item) identified by the ‘B’ with the list below

Bundle List:
BSKU SKU QTY
B101 X300 1
B101 X400 2
B101 X500 3

SO, after the import the order will look like this.

Order item qty
100 X101 2
100 X200 1
100 X300 2
100 X400 4
100 X500 6

I can replace the one SKU no problem I just can not continue through the list.

Thanks for your continued support, JD

Please Log in to join the conversation.

More
7 years 3 months ago - 7 years 3 months ago #2961 by FlowHeater-Team
Replied by FlowHeater-Team on topic Import Bundle Items
Hi JD,

It would be posible but it´s a bit tricky :-)

First you have to prepare a CSV file with all available bundle articles. For each bundle article you need one line.

The first column is the bundle article number and the second column ist the count how many articles the bundle article contains. The next colums are the containing article numbers followed by the quantity and so on.

For example:
item,count,artnr1,qty1,artnr2,qty2,artnr3,qty2,...
B101,3,X300,1,X400,2,X500,3,...

To extent the current read text file for the containing bundle articles you need the GroupOut Heater . With this you just make as many line copies you need for the bundle article. The count are read with the help of the String Replace Heater from the bundle article CSV file .

Now you need a little script (see below) and the help if the .NET Script Heater to get dynamically the bundle article and the quantity or in case no bundle article the original values from the READ side.

Sounds quit strange but I guess you are able to understand the attached example I’ve made for you.

Important: Please take care about the input parameter sequence!

C# .Net Script to extend the bundle articles
Code:
// you may change here the bundle file name and the delimiter string bundlefile = "bundles.txt"; char [] delimiter = { ',' }; public object DoWork() { if (InValues.Length < 2) throw new Exception("min. 2 input parameter expected!"); // read all lines from the bundle file string [] lines = File.ReadAllLines(bundlefile); // get current group out position (AutoID Heater) int pos = (int)InValues[0].GetInt(); // get current item string item = (string)InValues[1].GetString(); // in case a third parameter is valid get the quantity int qty = -1; if (InValues.Length > 2) qty = (int)InValues[2].GetInt(); // loop over all lines an search for a bundle article foreach (string line in lines) { // split the line and compare the item number string [] columns = line.Split(delimiter); if (item.CompareTo(columns[0]) == 0) { // bundle article found if (qty < 0) return columns[pos * 2]; else return Convert.ToInt32(columns[1 + pos * 2]) * qty; } } // in case no bundle article return the original values if (qty < 0) return InValues[1].GetValue(); else return InValues[2].GetValue(); }

File Attachment:

File Name: replace-bu...ders.zip
File Size:3 KB

Best wishes
Robert Stark

Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
Attachments:
Last edit: 7 years 3 months ago by FlowHeater-Team.

Please Log in to join the conversation.

More
7 years 3 months ago #2962 by JD Cox
Replied by JD Cox on topic Import Bundle Items
Thank you, this works great thanks for the example too that really helped. :)

JD

Please Log in to join the conversation.

Time to create page: 0.340 seconds

FlowHeater - The Data Specialist

Efficient data integration and transformation with FlowHeater – the perfect solution for a seamless transfer of your data.

Rechtliches

Support & Contact

Kontaktinformation

Telefon:0951 / 99339792 E-Mail:This email address is being protected from spambots. You need JavaScript enabled to view it.

Copyright © 2009-2024 by FlowHeater GmbH. All rights reserved.