Page 1 of 1

How to import ONLY multiple images?

Posted: Sun Apr 19, 2009 5:57 pm
by bemara579
I am trying to import multiple images via DataPort. This is how my product node looks like:

<Product>
<ProductId>12</ProductId>
<Images><ProductImage>
<ProductImageId>0</ProductImageId>
<ProductId>12</ProductId>
<ImageUrl>~/Assets/ProductImages/34430_short.jpg</ImageUrl>
<ImageAltText>Stool</ImageAltText>
</ProductImage>
</Images>
</Product>

This imports the additional image fine, but it is overwriting my options, templates, and manufacturer data for the product. How do I only import additional images without including all the other fields?

Re: How to import ONLY multiple images?

Posted: Wed Apr 29, 2009 9:48 am
by Naveed
The problem with the above xml is that when importing the product the import routine thinks that you want to re-set the product data. So, you have to include all other fields as well.
If you have already setup the product data on website then the best way to do so is to export the product xml data and then embed the image details same way as you are doing above and re-import the data.

Re: How to import ONLY multiple images?

Posted: Wed Apr 29, 2009 4:16 pm
by bemara579
That creates a real mess (merging, matching, formatting xml). Why can't it just ignore the fields that I am leaving out? If this can not be done with DataPort, how can I do this with the database?

Re: How to import ONLY multiple images?

Posted: Thu Apr 30, 2009 6:10 am
by Naveed
You can use a sql query like the following:

Code: Select all

INSERT INTO ac_ProductImages(ProductId,ImageUrl,ImageAltText,OrderBy)
VALUES (4,'~/Assets/ProductImages/a.jpg','',22);
where last 22 represents OrderBy value. Although it is not required to provide the OrderBy but it is recommended to provide a value, for each subsequent image for the same product the OrderBy value can simply be incremented by one.