How to add a column for an existing table using install() function in classes and how we can trigger

15 views Asked by At
How to add a column for an existing table using install() function in classes and how we can trigger,
as this is not added as module so there is no option to trigger the install() function from Admin 
side in Prestashop 1.5.6

override/classes/Feature.php
<?php

class Feature extends FeatureCore {

public function __construct()
{
 
 $this->install();
}
public function install()
{   
  // Execute the SQL query to alter the database
    Db::getInstance()->execute("
        ALTER TABLE `"._DB_PREFIX_."feature`
        ADD COLUMN `new_column` INT(11) NOT NULL AFTER `email_template_filter`
    ");
    
    return true;
}

?> Currently I triggered like this.But this will works only when we load the Feature class,ie need to run specific page .But I need this to trigger in another method.

0

There are 0 answers