Start Part 3 - Delete Images, Fix Image, Import Images with PrestaShop built in import engine!


DELETE IMAGE BUTTON:

The Delete Image button is needed for two reasons.

1. If PrestaShop was installed with the sample products in the data base then, the Delete Image button will erase the Image tables and images in the /img/p directory. It will not touch the following files which are used for missing images:

en-default-home.jpg
en-default-large.jpg
en-default-medium.jpg
en-default-small.jpg
en-default-thickbox.jpg
en.jpg
es-default-home.jpg
es-default-large.jpg
es-default-medium.jpg
es-default-small.jpg
es-default-thickbox.jpg
es.jpg
fr-default-home.jpg
fr-default-large.jpg
fr-default-medium.jpg
fr-default-small.jpg
fr-default-thickbox.jpg
fr.jpg
index.php

2. The second reason is because the product data feeds from STC are not put together in chronological order. A new product could be line item 5800 instead of the expected end of file line item. Since the product data feeds are put together randomly any time STCtoPresta is put into "New Database" mode and Create Categories are changed or Update Database is used. Then the current images won't match the id numbers of the changes just done.

There is an alert warning if you press the Delete Images button. So please be sure you need to delete all images, because you'll need to do all images over again. However this will fix any changes to the Product data base that might have cause the product numbers to be different.


IMPORT IMAGE BUTTON:

The Create Image CSV button creates a file for only missing product numbers. So the first run it would create a file that covers all the products in your PrestaShop data base. If new products are added to the data base then only those images are included. An new image upload of all products can take 4 hours or more to complete. The downloading and 6 image per product creation can take a long time to complete!

As with some of the other buttons. The Create Image CSV File for importing into PrestaShop should wait until you have STCtoPresta set to "Update Only" mode. PrestaShop import engine needs the products id and name in the Product table to create the images.

The Create Image CSV button will put a file in the /Admin/import directory (Chmod 0777). This is the location that PrestaShop will import csv files into it's database. The import process is pretty slow since each and every product requires at least 6 images, and if that product has additional images then those require 6 each too.

PrestaShop does not have any feed back like STCtoPresta does with it's progress bar during long waits. In fact the first time you use PrestaShops import engine your IE / FF browser will timeout waiting for a response from the PrestaShop web page. This is why I've put a popup page that will refresh every 15 seconds so you can know when the whole process is done.

NOTE: If you get double images loaded for products then you have an older AdminImport.php file. I don't think they have made this fix available on their download version. There is however a link that someone was nice enough to post:

http://www.prestashop.com/forums/


 

1. When you're ready to import images. Click the Create Image CSV button. 

2. Click Tools > Import. You'll see:

 

Import 1

I used the all_images.csv file name just to keep it as the first one to show. Everything highlighted needs to remain the same. I wanted to make this as easy as possible!

3. Select which enity to import: to Products

Import2 

4. Select Next Step button and you'll see:

 

Import3

Keep the highlighted area above the same. All is as it should be!

5. Change the last select button to Image URLs

Import4

6. Once it looks like the above then just hit the Import CSV data button. Then just keep an eye on the popup I created as the images are being imported. With the number of images that PrestaShop converts it will naturally timeout most any browser waiting for a response from this web page.


With STCtoPresta in "Update Only" mode all new products are put at the end of the product table in the database. The stcCron.php file will send you an email anytime new products are added. For these new products you'll need to complete the steps above so PrestaShop can import the new images for the new products. This can not be automated because of the way PrestaShop needs to import and create 6 images per product.

 


FIX IMAGE BUTTON:

The Fix Image button procedures are exactly like the Import Image procedures. You'll receive a notice with the number of images missing, if the number is zero. Congratulations all images are available and showing, however if the number is greater then zero you'll need to complete the same procedures you used above to fix the missing images. 

This button should be used anytime you complete the procedures above for importing images. If there are missing images you'll have to wait for STC to upload those images. I've found the easy way to check is randomly pick one or two images URL's and enter the url in your browser to see if the image shows.

STC has a Lag time when new products are added. I've had to wait several hours for the new images to become available. So don't be in a hurry to import images / fix images when new products show up. PrestaShop will show no image available in the mean time.


You can view this article online at:
http://www.home-port.net/user_guide/index.php/article/start3-presta