oc-content/themes/veronika/functions.php
// ADD THEME COLUMNS INTO ITEM TABLE
ADD THEME COLUMNS INTO ITEM TABLE
ADD THEME COLUMNS INTO ITEM TABLE
function veronika_add_item_fields() {
  $conn = DBConnectionClass::newInstance();
  $data = $conn->getOsclassDb();
  $comm = new DBCommandClass($data);
  $db_prefix = DB_TABLE_PREFIX;
  $struct = osc_base_path() . 'oc-content/themes/veronika/model/struct.sql';
  $sql = file_get_contents($struct);
  if(!$comm->importSQL($sql)){ 
    throw new Exception(__('Error creating tables for Veronika theme. Check if these tables exists, if yes, drop them: t_item_veronika, t_category_veronika, t_item_stats_veronika.', 'veronika'));
  }
}
function veronika_add_item_fields ( ) { $ conn = DBConnectionClass :: newInstance ( ) ; $ data = $ conn -> getOsclassDb ( ) ; $ comm = new DBCommandClass ( $ data ) ; $ db_prefix = DB_TABLE_PREFIX ; $ struct = osc_base_path ( ) . 'oc-content/themes/veronika/model/struct.sql' ; $ sql = file_get_contents ( $ struct ) ; if ( ! $ comm -> importSQL ( $ sql ) ) { throw new Exception ( __ ( 'Error creating tables for Veronika theme. Check if these tables exists, if yes, drop them: t_item_veronika, t_category_veronika, t_item_stats_veronika.' , 'veronika' ) ) ; } }
ADD THEME COLUMNS INTO ITEM TABLE
ADD THEME COLUMNS INTO ITEM TABLE
//$query = "ALTER TABLE {$db_prefix}t_item ADD s_phone VARCHAR(100);"; //$result = $comm->query($query); //$query = "ALTER TABLE {$db_prefix}t_item ADD i_condition VARCHAR(100);"; //$result = $comm->query($query); //$query = "ALTER TABLE {$db_prefix}t_item ADD i_transaction VARCHAR(100);"; //$result = $comm->query($query); //$query = "ALTER TABLE {$db_prefix}t_item ADD i_sold VARCHAR(100);"; //$result = $comm->query($query); //$query = "ALTER TABLE {$db_prefix}t_item_stats ADD i_num_phone_clicks INT(10) DEFAULT 0;"; //$result = $comm->query($query); // CREATE NEW TABLES IF DOES NOT EXISTS // CREATE INDEXES MANUALLY, IF THERE IS PROBLEM /*
  $query = "ALTER TABLE {$db_prefix}t_item_veronika ADD FOREIGN KEY (fk_i_item_id) REFERENCES {$db_prefix}t_item (pk_i_id) ON DELETE CASCADE ON UPDATE CASCADE";
  $result = $comm->query($query);

  $query = "ALTER TABLE {$db_prefix}t_item_stats_veronika ADD FOREIGN KEY (fk_i_item_id) REFERENCES {$db_prefix}t_item (pk_i_id) ON DELETE CASCADE ON UPDATE CASCADE";
  $result = $comm->query($query);

  $query = "ALTER TABLE {$db_prefix}t_category_veronika ADD FOREIGN KEY (fk_i_category_id) REFERENCES {$db_prefix}t_category (pk_i_id) ON DELETE CASCADE ON UPDATE CASCADE";
  $result = $comm->query($query);
  */