To upgrade prestashop module.
First Upgrade your module version no. from module's config.xml file.
Also update your module version no. from module's main php file.
you have to change,
public function __construct() { $this->version = '';Second, create upgrade file inside your modules upgrade folder.
it should be named as upgrade/install-1.1.2.php
You can put your version no. higher or eual to the version no. defined in your modules main file and config.xml file.
Third in your upgrade file add below code:
** this is just a example of a upgrade script.
** you can change field name according to your need.
<?php if (!defined('_PS_VERSION_')) exit; function upgrade_module_1_1_2($object) { $upgrade_version = '1.1.2'; $object->upgrade_detail[$upgrade_version] = array(); $query = 'ALTER TABLE `'._DB_PREFIX_.'my_mod` ADD `learning` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `id`'; if (!Db::getInstance()->execute($query)) $object->upgrade_detail[$upgrade_version][] = $object->l(sprintf('Can\'t Add %s field', _DB_PREFIX_.'my_mod.learning')); return (bool)!count($object->upgrade_detail[$upgrade_version]); }Now, run your back office.
You can see your module upgrade success message there.
0 Comments