Importing new products with variants via XML??

A forum where issues related to the DataPort utility can be discussed.
Post Reply
martinhenze
Ensign (ENS)
Ensign (ENS)
Posts: 5
Joined: Sat Jan 10, 2009 10:18 pm

Importing new products with variants via XML??

Post by martinhenze » Fri Feb 20, 2009 6:47 pm

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

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: Importing new products with variants via XML??

Post by Naveed » Sat Feb 21, 2009 2:51 am

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.

martinhenze
Ensign (ENS)
Ensign (ENS)
Posts: 5
Joined: Sat Jan 10, 2009 10:18 pm

Re: Importing new products with variants via XML??

Post by martinhenze » Sat Feb 21, 2009 3:48 pm

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Importing new products with variants via XML??

Post by mazhar » Mon Feb 23, 2009 10:16 am

No command line interface available yet for dataport.

Post Reply