How to upgrade Prestashop 1.6 to Prestashop 1.7

Despite there are modules like this or services as Prestashopmanager to import data and migrate Prestashop 1.6 to new versión 1.7, if we do not have a big budget or our shop is very big (module will get “frozen” during the process), we will have to think of a manual upgrading.

This updating implies importing present 1.6 database to new 1.7 database, which apart from using new tables, those usually related to products, orders and customers, as former version upgrades, they always have changes in comparison with the other version (field name chage, properties and creation of new fields).

This proposal of manual upgrading to Prestashop 1.7 does not take into account changes in files nor folders, source code and of course, themes and modules, most of the latter will not be compatible with new version and it implies a review or updating of each element, as in the proposal by Prestashop for upgrading, only data will be dealt with:

“the template system has been rewritten, so your theme will either have to be changed or entirely rewritten. Additionally, your modules will need to be carefully examined and likely adapted, at least in terms of design””Take note that this module will only deal with your store’s data. The theme and modules will be those used by default, and your theme from version 1.5/1.6 will be deactivated, as will all of your third-party modules”
Source:https://www.prestashop.com/blog/en/prestashop-1-7-answers-questions/)

The objective of this article focuses on transferring catalogue, customer and order data to a new Prestashop 1.7 installation (once these data are imported -the most important issue- there will be time to consider the implications of changing or updating the former theme, used modules, etc.).

Important update info related to friendly URLs (21th Nov):
Friendly URL structure in PS 1.7 is different from PS 1.6: the id_product_attribute is included after the id_product and this is NOT something optional, so that you must bear in mind that if you have good SEO results now, you will lose those indexed URLs and have to re-index the new ones (obviously if your shop has a few dozens of pages, you can use the 301 redirect techniques and so forth, but if you are working with a several thousand catalogue, maybe it is not worth moving to PS 1.7 for the moment — if you know some specific module to override this default behaviour or some hack to make old 1.6 URLs work in 1.7, please comment below.

Steps for this upgrading or DATA migration to Prestashop 1.7 would be:

  1. Make a fresh installation of Prestashop 1.7
  2. Backup present PS 1.6 tables related to PRODUCTS, CUSTOMERS and ORDERS (i.e.: ps_product_17)
  3. Modify those tables so they have the same structure as PS 1.7 (detail modification below)

Option 1:

4) Sql export data originally in 1.6 version, now modified for 1.7 with data
5) Insert former data into PS 1.7 tables

Option 2 (only if working on the same database):

4) Rename original PS 1.7. tables (i.e.: ps_product_ORIGINAL)
5) Rename modified 1.6 tables to 1.7 original tables (i.e.: ps_product_17 to ps_product)

6) Check shop and data access

7) Copy product image folder “img/p” from PS 1.6 installation to PS 1.7 installation folder

SQL installation files of the versions taken as reference to compare the versions between the tables can be downloaded from http://goo.gl/WPM37D

NOTE: SQL instructions detailed below are only for first table “_product” and are merely guidelines, table name and/or prefix may vary depending on the case. Rest of sqls can be written by taking as reference the syntax to add and rename fields.

PRODUCTS

TABLE “_product”
 New field isbn (after ean13):
 ALTER TABLE `_product` ADD `isbn` varchar(13) DEFAULT NULL AFTER ean13

New field show_condition (after available_date):
 ALTER TABLE `_product` ADD `show_condition` tinyint(1) NOT NULL DEFAULT ‘0’ AFTER available_date

New field state (final de TABLE):
 ALTER TABLE `_product` ADD `state` int(11) unsigned NOT NULL DEFAULT ‘1’

Renamed field id_product_redirected (now `id_type_redirected`):
 ALTER TABLE `_product` CHANGE `id_product_redirected` `id_type_redirected`int(10);

TABLE “_product_shop” 
New field (after available_date): `show_condition` tinyint(1) NOT NULL DEFAULT ‘0’, Renamed field: “id_product_redirected” now is `id_type_redirected`

TABLE “_product_attribute”
New field (after ean13): `isbn` varchar(13) DEFAULT NULL,
Changes in antepenultimate and last fields:
`default_on` tinyint(1) unsigned NULL DEFAULT NULL,
`available_date` date DEFAULT NULL,

TABLE “_product_attribute_shop”
New field (before id_product_attribute): `id_product` int(10) unsigned NOT NULL,
Changes in antepenultimate and last fields:
`default_on` tinyint(1) unsigned NULL DEFAULT NULL,
`available_date` date DEFAULT NULL,
New keys:
UNIQUE KEY `id_product` (`id_product`, `id_shop`, `default_on`)

TABLE “_product_download”
 UNIQUE KEY `id_product` (`id_product`)

TABLE “_product_tag”
New field (at the end of TABLE): `id_lang` int(10) unsigned NOT NULL, New key: KEY `id_lang` (`id_lang`,`id_tag`)

TABLE “_specific_price”
 KEY `id_product_attribute` (`id_product_attribute`), KEY `id_shop` (`id_shop`), KEY `id_customer`(`id_customer`), KEY `from` (`from`), KEY `to` (`to`), UNIQUE KEY `id_product_2` (`id_product`,`id_product_attribute`,`id_customer`,`id_cart`,`from`,`to`,`id_shop`,`id_shop_group`,`id_currency`,`id_country`,`id_group`,`from_quantity`,`id_specific_price_rule`)

TABLE “_image_shop”
New field (at the beginning of TABLE): `id_product` int(10) unsigned NOT NULL, Keys: PRIMARY KEY (`id_image`, `id_shop`), UNIQUE KEY `id_product` (`id_product`, `id_shop`, `cover`), KEY `id_shop` (`id_shop`)

TABLE “_category”
Keys: KEY `category_parent` (`id_parent`), KEY `nleftrightactive` (`nleft`, `nright`, `active`), KEY `level_depth`(`level_depth`), KEY `nright` (`nright`), KEY `activenleft` (`active`,`nleft`), KEY `activenright`(`active`,`nright`)

CUSTOMERS

TABLE “_customer”
Length field change from 32 to 60: `passwd` varchar(60) NOT NULL, 
New fields (at the end of TABLE): `reset_password_token` varchar(40) DEFAULT NULL, `reset_password_validity` datetime DEFAULT NULL,

ORDERS

TABLE “_orders”
New field (after round_mode): `round_type` tinyint(1) NOT NULL DEFAULT ‘1’,

TABLE “_order_invoice”
 New field (after total_wrapping_tax_inc): `shop_address` text DEFAULT NULL,
Change decimal fields from (17,2) to (20,6)

TABLE “_order_detail”
New field (after product_attribute_id): `id_customization` int(10) unsigned DEFAULT 0, New field (after ean13): `product_isbn` varchar(13) DEFAULT NULL, New field(at the end of table):`original_wholesale_price` DECIMAL(20, 6) NOT NULL DEFAULT ‘0.000000’,

Original Spanish version published at abrasutiendaeninternet.blogspot.com.

Do you already know my last book: Key factors to sell online for real ?