How to import ONLY multiple images?

A forum where issues related to the DataPort utility can be discussed.
Post Reply
bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

How to import ONLY multiple images?

Post by bemara579 » Sun Apr 19, 2009 5:57 pm

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?

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

Re: How to import ONLY multiple images?

Post by Naveed » Wed Apr 29, 2009 9:48 am

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.

bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

Re: How to import ONLY multiple images?

Post by bemara579 » Wed Apr 29, 2009 4:16 pm

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?

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

Re: How to import ONLY multiple images?

Post by Naveed » Thu Apr 30, 2009 6:10 am

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.

Post Reply