Magento: Bulk upload for the product image

Many users have reported issues when trying to import images using the default Import/Export within Magento. I too have suffered this headache. Luckily, I have figured out a way to bypass any issues by separating out our import files.

Traditionally when we import our CSV, we have one giant document full of attributes. Including all the image references  Well, in my version don’t include the image attributes. Instead, we’ll put those into a new CSV along side a column with the SKU of the product.

In order to import a second CSV that is customised like this we’ll need a separate import profile. I’ll teach you how to create one now.

Step 1) Create the advanced profile

The solution is to create a custom import profile (System > Import/Export > Dataflow – Profiles). You only need to include the attributes that are required, which is just the SKU. Plus the appropiate image attributes. Plus labels if you want to go all out.

When you are creating your new profile, enter the following settings:

Magento Import Profile Setup

Magento Import Profile Setup

Now you can hit save! With our Profile now complete, we just need to create the folder media/import. This is where you will be storing all your images awaiting import.

Step 2) Create your Magento images import CSV

So now we have our profile created all we need to do is create our CSV. The CSV is pretty standard format. First of we have our SKU, and then followed by our image attributes.

When uploading images, they need to be within a folder called media/import. Once saved to that folder you can then reference them relatively. By that I mean if your image is in media/import/test.jpg in your csv reference it as /test.jpg. It’s as easy as that.

Now finally all you need to do is modify your CSV file to include only the following columns:

sku, image, image_label, small_image, small_image_label, thumbnail, thumbnail_label

Here is how I managed to import a product with images:
1. Create a new Import Profile:
Entity Type: Products
Direction: Import
Data Transfer: Interactive
Data Format: CSV
Value Delimiter: ,
Enclose Values In: “
Original Magento attribute names in first row: No

2. Field Mapping - click “+ Add Field Mapping” and specify each of the columns in your CSV file in the order that they appear. Use the example above for which fields you need. I have a custom Attribute set, so I had a couple different fields.
Tip: start out by not mapping your images—make sure everything else works fine

3. Click “Save and Continue Editing” (of your import profile)

4. Create your CSV file: start out with 1 product until things work
a. It’s okay to start with Excel, but after you save as CSV, open the CSV file in NOTEPAD
b. Enclose all fields in “ “
c. I also removed any weird/special characters such as hard returns
d. Keep your Short Description short. I hit errors when I tried including several sentences. I believe this is a bug since I can add a pretty long “short description” via the gui.
e. Delete the top, header row with attribute names. No one else has mentioned having to do this, but I had to. Make sure there are no blank lines above or below your product row.

5. Try your import
a. In your Import Profile, click “Upload File” on the left menu
b. Browse and select your file
c. Click “Save and Continue Editing”
d. Click “Run Profile” in the menu on the left
e. Select the file you uploaded in the dropdown menu. After you have done this once, you may want to delete the old import files from the /var/import directory
f. Click “Run Profile in Popup”

6. If you get errors, double-check that you have included all required attributes and in the correct order, don’t have spelling errors, all items are enclosed in double-quotes, there are no extra line breaks before/after your row of data, you removed the header row…

7. Once things are working (go back and delete the newly added product), try the images
a. Upload your image file(s) to /media/import
b. Update your field mapping and add image, small_image, thumbnail
c. Update your CSV file (just do this in Notepad to avoid any issues): add your images at the end of the line, separated by a comma, preceded by a backslash and enclosed in double-quotes. I.e. you will need to type: ,"/myimage.gif”,"/mysmallimage.gif”,"/mythumbnail.gif"
d. Upload your new CSV file and try the import again

猜你喜欢

转载自wuchengyi.iteye.com/blog/1934063
今日推荐