1-Click Upgrade PrestaShop Auto Upgrade Module

By | March 7, 2014

Upgrade documentation for PrestaShop (PS) v.1.4.4.1 over to PS v.1.5.6.2 using Auto Upgrade Module, also known as the 1-Click Upgrade Module offered on addons.prestashop.com.

Step 1.) Download and install the autoupgrade module onto your PS.

Step 2.) Place your store under maintenance mode.

Step 3.) Go to: Modules > Administration; and configure 1-click Upgrade.

Step 4.) Backup your files & Click on Upgrade!

Results..

Analyzing the situation …Shop deactivated. Now downloading (this can takes some times )…
[Ajax / Server Error for action download] textStatus: “error ” errorThrown:”Internal Server Error ” jqXHR: ” “

Steps to correct Ajax Error..

Step 1.) Upload PS v.1.5.6.2 with FTP to: /admin/autoupgrade/latest/prestashop

Step 2.) Within the configuration of autoupgrade module, select More options (Expert mode).

Step 3.) Select the channel: Local directory and label your version.

Step 4.) Save

Results..

Settings update successful.

Step 5.) Click Upgrade PrestaShop Now!

Results..

Upgrade complete, with a few issues.. Apparently, these issues are common and can be resolved.

A to do list will generate after upgrade is complete, instructing on how to resolve common issues that may occur.

Out of the 5 to do list items, I experienced product images missing:

  1. Cookies have changed, you will need to log in again once you refreshed the page
  2. Javascript and CSS files have changed, please clear your browser cache with CTRL-F5
  3. Please check that your front office theme is functional (try to create an account, place an order…)
  4. Product images does not appear in the front office? Try regenerating the thumbnails in Preferences > Images
  5. Do not forget to reactivate your shop once you have checked everything!

Steps to correct missing product images..

Step 1.) BO: Preferences > Image – Product Images: until you move all images to new file system, use Legacy Image File System; set this to ‘yes’ and save.

Results..

Duplicate images were found when moving the product images. This is likely caused by unused demonstration images. Please make sure that the folder/home/domain/public_html/img/p/duplicates/only contains demonstration images, and then delete it.

Step 1.) Delete folder /home/domain/public_html/img/p/duplicates/

Step 2.) Preferences > Image – Regenerate thumbnails = select products, format: all & DON’T erase previous image.

Results..

217 errors
Original image is missing or empty (/home/domain/public_html/img/p/1/7/0/170.jpg) for product ID 96

Steps to correct error message ‘original image is missing or empty’.

Step 1.) First, confirm images exist.

Results..

There are missing product images..

v.1.4.4.1 uses The Legacy File System where all product images are within /img/p/

v.1.5+ uses the new File System using sub directories that match the image ID /img/p/9/6/96-197.jpg .

e.g. 
Legacy File System = /img/p/96-197.jpg | 96- = image ID
New File System = /img/p/9/6/197.jpg | folders /9/6/ = image ID

Step 1.) BO: Preferences > Image – Move Images; click on button ‘move images’.

Images moved successful

Step 2.) BO: Preferences > Image – Use the Legacy Image File System = No

Step 3.) BO: Preferences > Image – Regenerate thumbnails = select products, format: all & erase previous image.

Results..

401 errors
Original image is missing or empty (/home/domain/public_html/img/p/1/7/0/170.jpg) for product ID 96

Step 1.) Investigate product ID 96

Results..

The product ID is missing from image path. I investigated both Live PrestaShop Store (LPS) and Testing Domain (TD); product ID is missing on TD.
e.g. TD missing image = /domain/170-thickbox_default/170.jpg | LPS image displayed = /domain/96-170-thickbox/170.jpg

This error occurred once before, during a copy of my LPS that I migrated to a TD; both running PSv.1.4.4.1.

And it was a permissions issue, the solution was to chmod /img/ including all sub directories to 755; another post was dedicated to this issue.

Step 1.) Set file permissions chmod to 755 to all directories & sub directories.

Step 2.) BO: Preferences > Image – Regenerate thumbnails = select products, format: all & DON’T erase previous image.

Results..

217 errors
Original image is missing or empty (/home/domain/public_html/img/p/1/7/0/170.jpg) for product ID 96

Step 1.) In the BO, clear the cache: Advanced Parameters > Smarty = Clear Smarty cache & Autoload cache

Update successful

Results..

The product images are still missing.

Investigate other options from PrestaShop forum..

–REVERTED– 

Step 1.) Set creation date earlier than 2013-03-26′. Edit the settings file /config/settings.inc.php
e.g. define(‘_PS_CREATION_DATE_’, ‘2011-09-11’);

REVERTED: /config/settings.inc.php, due to _PS_CREATION_DATE_ error: Notice: Constant _PS_CREATION_DATE_ already defined in /config/settings.inc.php on line 20

–END OF REVERTED–

Step 1.) Edit /controllers/admin/AdminImagesController.php
56. $this->display_move = true;

Step 3.) BO: Preferences > Image – Move Images; click on button ‘move images’.

Step 4.) BO: Preferences > Image – Regenerate thumbnails = select products, format: all & DON’T erase previous image.

Images moved successful

Results..

217 errors
Original image is missing or empty (/home/domain/public_html/img/p/1/7/0/170.jpg) for product ID 96

Steps to correct errors through process of elimination using different regenerate options.

Step 1.) BO: Preferences > Image – Regenerate thumbnails = select products, format: all & erase previous image.

I’ve been hesitant on selecting the format option to ‘erase previous image’, however numerous of attempts have been performed without deleting. So far, this option actually seems to be doing something.. After I regenerated images, the web browser indicates it’s processing the action.

It timed out 🙁

Let’s try another format..

Step 2.) BO: Preferences > Image – Regenerate thumbnails = select products, format: home & erase previous image.

Results..

401 errors
Original image is missing or empty (/home/domain/public_html/img/p/1/7/0/170.jpg) for product ID 96

Let’s try another format..

Step 3.) BO: Preferences > Image – Regenerate thumbnails = select products, format: large & erase previous image.

Results..

401 errors
Original image is missing or empty (/home/domain/public_html/img/p/1/7/0/170.jpg) for product ID 96

O.k., that is time consuming.. I need to investigate other options.

Step 1.) First, investigate images by disabling Friendly URL.
BO: preferences > SEO & URLs – Set up URLs = disable both Friendly URL & Accented URL.

product image: \public_html\img\p\1\3\4\0\1340-home.jpg
product image: \public_html\img\p\1\3\4\0\1340-home_default.jpg

If I remove _default from the image label e.g. 1340-home_default.jpg = 1340-home.jpg
Then product image is displayed!

–REVERT–

This is one method I tried and it did not work, so I reverted back.

Step 1.) Go to default 1.5.6.2 theme, edit product.tpl and remove _default from image tags:
186 large_default
191 -default-large_default
211 thickbox_default
212 medium_default
551 medium_default

Step 2.) Clear Smarty cache & Autoload cache

Results..

Did not work.. 🙁

Step 3.) Revert product.tpl back to original state.

–END OF REVERT–

A post on PS forum mentioned a bug similar to mine, but was opposite in how the image label was represented.  There issue was that by default image preferences were set: small_default, medium_default, large_default, thickbox_default, category_default, etc. and required the removal of _default. Mine is not the case.. I require _default

Next, under BO: Preferences > Image

I’ll edit the image names and add the extension _default.

Step 1.) BO: Preferences > Image = renamed all images with _default e.g. small_default, medium_default, large_default, thickbox_default, catgeory_default, home_default large_scene_default, thumb_scene_default

Step 2.) BO: Preferences > Image = Regenerate thumbnails.. This time, I’m going to select one at a time.

e.g. Select an image: products, Select a format, home_default & erase previous images.

Results..

Regenerated thumbnails and browser timed out after 30 or so minutes, however a good majority of product images now appeared!

Now, I need to replace missing images and figure out why it timed out.

Step 1.) Upload the backup folder /img/p/

Thousands of images, nearly 400MB re-uploaded.

Step 2.) BO: Preferences > Image = Regenerate thumbnails.. I’m going to select one at a time.

e.g. Select an image: products, Select a format, home_default & Erase previous images.

Results..

401 errors
Original image is missing or empty (/home/domain/public_html/img/p/1/7/0/170.jpg) for product ID 96

Step 1.) BO: Preferences > Image = Regenerate thumbnails – select image: product, select format: all & erase previous images.

Results..

All product images archived & displayed! However, image categories are still missing.

Step 1.) BO: Advanced Parameters > Performance = Clear Smarty cache & Autoload cache.

Step 2.) BO: Preferences > Image = Regenerate thumbnails – select image: categories, select format: all & erase previous images.

Results..

Browser indicated that PS was processing action, then delivered a blank page 🙁
index.php?controller=AdminImages&token

 Step 1.) Confirm all category images reside /img/c/

Not all category images existed..

Step 2.) Upload category images from backup /img/c/

Step 3.) BO: Preferences > Image = Regenerate thumbnails – select image: categories, select format: all & erase previous images.

Results..

Did not work, received a blank page after 20 seconds 🙁

Step 1.) Enable Troubleshooting by editing /config/defines.inc.php

Line 28
Find: define(‘_PS_MODE_DEV_’, false);
Replace with: define(‘_PS_MODE_DEV_’, true);

Step 2.) BO: Advanced Parameters > Performance – Clear Smarty cache & Autoload cache; received error.

–ERROR–

Notice: Constant _PS_CREATION_DATE_ already defined in /config/settings.inc.php on line 20
Warning: Cannot modify header information – headers already sent by (output started at /config/settings.inc.php:20) in /classes/Tools.php on line 141

–END OF ERROR–

Steps to resolve error..

Step 1.) Open /config/settings.inc.php and remove line 20.

Step 2.) BO: Advanced Parameters > Performance – Clear Smarty cache & Autoload cache.

Results..

SOLVED: Clear Smarty cache & Autoload cache works!

Now, time to regenerate thumbnails..

Step 1.) BO: Preferences > Image = Regenerate thumbnails – select image: categories, select format: all & erase previous images.

Results..

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 9600 bytes) in /classes/ImageManager.php on line 365

Steps on how to increase the memory on your server from timing out. There are a couple of methods in achieving this.

Step 1.) Using cPanel, select account and edit its php.ini file.
Or you can log-in with SSH and root, edit the php.ini located in /usr/local/lib/php.ini

Step 2.) I adjusted the php.ini file residing on testing domain’s account, following cPanels instructions: http://forums.cpanel.net/f34/php-memory-limit-63777.html

Default settings:

cPanel PHP max execution time –> 90 seconds
cPanel PHP max POST size –> 55 MB
cPanel PHP max upload size –> 50 MB

Desired settings:

cPanel PHP max execution time –> 360 seconds
cPanel PHP max POST size –> 500 MB
cPanel PHP max upload size –> 250 MB

Step 3.) Save & Restart Apache.

Results..

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 9600 bytes) in /classes/ImageManager.php on line 365

Apparently, the php.ini file that I restored to use for that particular account did not take effect.

Oh well, I’ll just edit the server’s main php.ini file..

Step 1.) Edit main php.ini file by logging into your cPanel’s WHM and go to: PHP Configuration, adjust the following.
Or you can log-in with SSH and root, edit the php.ini located in /usr/local/lib/php.ini

memory_limit was 32M | changed to -1
upload_max_filesize was 2M | changed to 500M
max_execution_time was 30 | changed to 360
max_input_time was 60 | changed to 360

Step 3.) Save & Restart Apache.

Results..

🙂 🙂 SUCCESS !!! 🙂 🙂

I’m no longer receiving blank pages when I regenerate images, and now all of them are displayed in both BO and FO.

Next, revert any edits made to file(s) during testing that are no longer required.

Revert 1.) Edit /controllers/admin/AdminImagesController.php; change back to false.
56. $this->display_move = false;

Revert 2.) Default PSv.1.5.6.2 theme, edit product.tpl and remove _default from image tags. This has been REVERTED back to original state.

Revert 3.) /config/settings.inc.php, remove _PS_CREATION_DATE_: define(‘_PS_CREATION_DATE_’, ‘2011-09-11’);
Due to error.. Notice: Constant _PS_CREATION_DATE_ already defined in /config/settings.inc.php on line 20

NOTES: Apparently, when images are missing from /img/p/ folder, and you attempt to regenerate thumbnails an improper file system takes place.

e.g. 
proper File System = /img/p/9/6/197.jpg | folders /9/6/ = image ID
improper File System = /img/p/1/9/7/197.jpg | image ID missing

BEWARE: Before upgrading to PSv.1.5.6.2, all product images using Legacy File System /img/p/ existed and store displayed correctly with the migrated data from PSv.1.4.4.1 At some point during the upgrade process, PS deleted a good majority of images. As long as current backups are accessible, then there is little to worry about.

Resources

Can’t auto upgrade any version, same error every time: http://www.prestashop.com/forums/topic/192406-cant-auto-upgrade-any-version-same-error-every-time/
Product Images Missing: http://www.prestashop.com/forums/topic/272842-solved-product-image-missing/
Product Images Missing after upgrade: http://www.prestashop.com/forums/topic/272333-solved-how-to-dont-show-product-images-after-upgrade-to-155/
Troubleshooting: http://doc.prestashop.com/display/PS15/Troubleshooting