Upgrade from OpenCart 2.1.0.2 to 2.3.0.2

Pre-Upgrade

  • Backup everything

    • PhpMyAdmin > Export database
    • Compress and copy the public_html/ folder
  • Set file and folder permissions for install

chmod 777 config.php	
chmod 777 admin/config.php
chmod 777 image/
chmod 777 image/cache/
chmod 777 image/catalog/
chmod 777 system/storage/cache/
chmod 777 system/storage/logs/
chmod 777 system/storage/download/
chmod 777 system/storage/upload/
chmod 777 system/storage/modification/
  • Delete any modification files (this may delete your OCMODs. proceed with caution!)
rm -rf system/storage/modification/*

I did delete all the files inside the modification folder and it didn’t seem to have affected all the OCMOD files that i had installed on the site. They were still there listed under Extensions > Modifications and i could install them by clicking the + button

Upgarde

  • Download and unzip OC 2.3.0.2 files
  • Backup config.php and admin/config.php
  • Upload the extracted upload/ folder into site’s root folder and overwrite existing files
  • Run the install script http://yourdomain.com/install

Post-Upgrade

  • Secure permissions (after install)
# delete install folder
if [ -d "install/" ]; then
  rm -rf install
fi

# To change all the directories to 755 (-rwxr-xr-x)
find . -type d -exec chmod 755 {} \;

# To change all the files to 644 (-rw-r--r--):
find . -type f -exec chmod 644 {} \;

# set 444 for admin files
chmod 444 config.php
chmod 444 admin/config.php
chmod 444 index.php
chmod 444 admin/index.php
chmod 444 system/startup.php

# set 777 for cache
chmod 777 image/cache/
chmod 777 system/storage/cache/
  • Delete folders
rm -rf catalog/model/total
rm -rf catalog/model/payment
rm -rf catalog/model/shipping
rm -rf catalog/controller/module
rm -rf catalog/controller/payment
rm -rf admin/controller/module
rm -rf admin/controller/payment
rm -rf admin/controller/shipping
rm -rf admin/controller/total
  • Delete OS Specific Files: Delete all .DS_Store files. (You’ll get these copied if you uploaded any files from your Mac. Deleting these is good because a: they’re clutter and b: sometimes they prevent deletion of folders as Linux systems may not delete folders if the directory isn’t empty/ has hidden files in it)
find . -name 'Thumbs.db' -exec rm -rf {} \;
find . -name '.DS_Store' -exec rm -rf {} \;
  • Remove troubleshooting code for displaying errors, if any
  1. After upgrade, clear any cookies in your browser to avoid getting token errors.
  2. Load the admin page & press Ctrl+F5 twice to force the browser to update the css changes.
  3. Goto Admin -> Users -> User Groups and Edit the Top Administrator group. Check All boxes.
  4. Goto Admin and Edit the main System Settings. Update all fields and click save, even if nothing changed.
  5. Load the store front & press Ctrl+F5 twice to force the browser to update the css changes.

opencart upgrade successful

Troubleshooting

White screen of death / Blank screen / Page isn’t working after copying files

  • First things first, add the following code to the top of index.php and install/index.php (after opening php tag <?php)
// Error reporting
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);

This will make sure that you see errors if there are any instead of a blank screen (white screen of death). Make sure to take it out after you’re done with the upgrade.

  • Once you’ve enabled error reporting and still see a blank page, check the site’s error log.

  • Make sure the database connection details are correct.

Error: Could not load model total!

Give up on 2.2.x compatibility and delete the following left-over folders

catalog/model/total
catalog/model/payment
catalog/model/shipping
catalog/controller/module
catalog/controller/payment
admin/controller/module
admin/controller/payment
admin/controller/shipping
admin/controller/total

Admin Login > Failed to load resource: the server responded with a status of 404 (Not Found)

The error traced back to a file in the modifications folder. So i just deleted the modifications

rm -rf system/storage/modifications/*

Extension specific errors

You’re bound to get some extension specific errors. Start installing your extensions once by one

e.g. This is for the One POS extension

Fatal error: Uncaught Exception: Error: Could not load model extension/total/pos_discount! in /var/www/3.dev.cakebox.me/public_html/system/engine/loader.php:59 Stack trace: #0 /var/www/3.dev.cakebox.me/public_html/catalog/controller/common/cart.php(34): Loader->model('extension/total...') #1 /var/www/3.dev.cakebox.me/public_html/system/engine/action.php(51): ControllerCommonCart->index(Array) #2 /var/www/3.dev.cakebox.me/public_html/system/engine/loader.php(24): Action->execute(Object(Registry), Array) #3 /var/www/3.dev.cakebox.me/public_html/catalog/controller/common/header.php(129): Loader->controller('common/cart') #4 /var/www/3.dev.cakebox.me/public_html/system/engine/action.php(51): ControllerCommonHeader->index(Array) #5 /var/www/3.dev.cakebox.me/public_html/system/engine/loader.php(24): Action->execute(Object(Registry), Array) #6 /var/www/3.dev.cakebox.me/public_html/catalog/controller/common/home.php(17): Loader->controller('common/header') #7 /var/www/3.dev.cakebox.me/public_html/system/engine/action.php(51): Con in /var/www/3.dev.cakebox.me/public_html/system/engine/loader.php on line 59
Fatal error: Uncaught Error: Call to undefined method Cart\Currency::formatFront() in /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php:2981 Stack trace: #0 /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php(5740): ControllerExtensionModulePos->createEmptyOrder(true, false, 0, 0) #1 /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php(1120): ControllerExtensionModulePos->getEmptyOrder(false) #2 /var/www/3.dev.cakebox.me/public_html/system/engine/action.php(51): ControllerExtensionModulePos->main() #3 /var/www/3.dev.cakebox.me/public_html/admin/controller/startup/router.php(26): Action->execute(Object(Registry), Array) #4 /var/www/3.dev.cakebox.me/public_html/system/engine/action.php(51): ControllerStartupRouter->index() #5 /var/www/3.dev.cakebox.me/public_html/system/engine/front.php(34): Action->execute(Object(Registry)) #6 /var/www/3.dev.cakebox.me/public_html/system/engine/front.php(29): Front->execute(Object(Action)) #7 /var/www/3.de in /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php on line 2981
Fatal error: Uncaught Error: Call to undefined method Cart\Currency::formatFront() in /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php:2981 Stack trace: #0 /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php(5740): ControllerExtensionModulePos->createEmptyOrder(true, false, 0, 0) #1 /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php(1120): ControllerExtensionModulePos->getEmptyOrder(false) #2 /var/www/3.dev.cakebox.me/public_html/system/storage/modification/system/engine/action.php(51): ControllerExtensionModulePos->main() #3 /var/www/3.dev.cakebox.me/public_html/admin/controller/startup/router.php(26): Action->execute(Object(Registry), Array) #4 /var/www/3.dev.cakebox.me/public_html/system/storage/modification/system/engine/action.php(51): ControllerStartupRouter->index() #5 /var/www/3.dev.cakebox.me/public_html/system/engine/front.php(34): Action->execute(Object(Registry)) #6 /var/www/3.dev.cakebox.me/public_html/system/engine/front. in /var/www/3.dev.cakebox.me/public_html/admin/controller/extension/module/pos.php on line 2981