Page 1 of 1

Importing new products with variants via XML??

Posted: Fri Feb 20, 2009 6:47 pm
by martinhenze
I've had good success importing new products with DataPort in CSV format, but the inability to import variants via CSV is a serious drawback. I've read here that that capability may be added in the future, but in the meantime I've been trying to figure out how to do it via XML import. I've been able to export products with variants, update price modifiers, etc., and re-upload, but have had no success in 1) adding new products, 2) adding new choices, or 3) removing existing choices. Can anyone here give me some guidance?

What I've tried thus far is this:

1) Download an existing product with variants as XML.
2) Edit the file, replacing the product- and option-specific IDs with empty fields and adding the appropriate product details. For example, I replaced <ProductId>1234</ProductId> with <ProductId /> in the (apparently mistaken) hope that AC7 will assign the ID, as it does during CSV upload. Similarly I replaced <OptionId>123</OptionId> with <OptionId />.
3) Attempt to upload the XML. DataPort immediately returns this error message:
"Some problem occurred"
"There is an error in the XML document (22, 16)"

I get the same, terse message and nothing else, whether debug is on or not. My first thought was that the error occurred at line 22, char 16 in my file. That happens to be the 'S' in the <StoreId> tag within the first <Product> block. Hmmm. The revised files for existing products that have uploaded successfully are identical up to this point with one exception: The line just before this is the blank product ID tag, <ProductId />. Is this causing the error? Must product and choice IDs be explicitly defined? I'm reluctant to experiment any further for fear of blowing a working store out of the water. Can anyone point me to detailed information on the inner workings of XML upload, or suggest another way to efficiently manage products with many variants?

Thanks,

Martin

Re: Importing new products with variants via XML??

Posted: Sat Feb 21, 2009 2:51 am
by Naveed
Please try with ID's value as zero, like:
<ProductId>0</ProductId>
<OptionId>0</OptionId>

Also if the product have other child associations, use the ID value zero for all of them.

I am currently not sure if this will work, but I think it should.

Re: Importing new products with variants via XML??

Posted: Sat Feb 21, 2009 3:48 pm
by martinhenze
Naveed,

Thanks for the guidance. That worked perfectly! In addition to making it possible to import new products with variants, the XML import also allowed me to specify additional images for each product and swatches for variants. This is a much more complete solution than the CSV import, and truthfully, I find it relatively easy to edit the XML using a code editor that supports regular expressions such as Smultron.

This may inspire me to put together an offline database app geared toward fast, efficient product catalog management. Any one know if DataPort has (or will have) a command line interface?

Thanks again, and have a great day!

Martin

Re: Importing new products with variants via XML??

Posted: Mon Feb 23, 2009 10:16 am
by mazhar
No command line interface available yet for dataport.