'item_icon_rl_id',
'type' => 'varchar' );
$dataset->defineColumns($columns);
// get dataset_column_id after insert
$all_columns = $dataset->getColumnDefinitions();
foreach($all_columns as $c){
if($c['dataset_column_name']=='item_icon_rl_id'){
$dataset_column_id = $c['dataset_column_id'];
break;
}
}
$icons = array(
array('catalog', ' '),
array('sale', ' '),
array('design', ' '),
array('extension', ' '),
array('system', ' '),
array('reports', ' '),
array('help', ' '),
array('category', ' '),
array('product', ' '),
array('manufacturer', ' '),
array('download', ' '),
array('review', ' '),
array('attributes', ' '),
array('extensions', ' '),
array('shipping', ' '),
array('payment', ' '),
array('templates', ' '),
array('languages', ' '),
array('total', ' '),
array('add_extension', ' '),
array('extensions_stores', ' '),
array('order', ' '),
array('customer', ' '),
array('customer_group', ' '),
array('coupon', ' '),
array('contact', ' '),
array('setting', ' '),
array('users', ' '),
array('localisation', ' '),
array('data', ' '),
array('updater', ' '),
array('cache', ' '),
array('messages', ' '),
array('logs', ' '),
array('report_sale', ' '),
array('viewed', ' '),
array('purchased', ' '),
array('banner_manager_stat', ' '),
array('abantecart', ' '),
array('documentation', ' '),
array('support', ' '),
array('template', ' '),
array('layout', ' '),
array('blocks', ' '),
array('menu', ' '),
array('content', ' '),
array('banner_manager', ' '),
array('all_settings', ' '),
array('settings_details', ' '),
array('settings_general', ' '),
array('settings_checkout', ' '),
array('settings_appearance', ' '),
array('settings_mail', ' '),
array('settings_api', ' '),
array('settings_system', ' '),
array('settings_newstore', ' '),
array('user', ' '),
array('permission', ' '),
array('language', ' '),
array('language_definitions', ' '),
array('currency', ' '),
array('stockstatus', ' '),
array('orderstatus', ' '),
array('country', ' '),
array('zone', ' '),
array('location', ' '),
array('taxclass', ' '),
array('lengthclass', ' '),
array('weightclass', ' '),
array('backup', ' '),
array('migrate', ' '),
array('datasets', ' '),
array('import_export', ' '),
array('file_uploads', ' '),
array('installlog', ' '),
array('error_log', ' ')
);
foreach($icons as $row){
$sql = "UPDATE ". $this->db->table('dataset_values')."
SET value_varchar = '".$this->db->escape($row[1])."'
WHERE dataset_column_id = ".$dataset_column_id."
AND row_id = (SELECT DISTINCT row_id
FROM ". $this->db->table('dataset_values')."
WHERE dataset_column_id = 10 AND value_varchar = '".$this->db->escape($row[0])."'
)";
$this->db->query($sql);
}
//add new menu
$m = new AMenu('admin');
$m->insertMenuItem(
array(
'item_id' => 'marketplace',
'item_text' => 'text_extensions_store',
"item_url" => 'window.open(\'http://marketplace.abantecart.com\');',
"item_icon_rl_id" => ' ',
"parent_id" => 'help',
"sort_order" => 4,
"item_type" => 'core'));
/*
* UPDATE STOREFRONT menu item icon rl_id
*/
$sql = "SELECT *
FROM abc_dataset_values
WHERE dataset_column_id=7 AND value_varchar LIKE '%db->query($sql);
$rm = new AResourceManager();
$rm->setType('image');
foreach($res->rows as $row){
$sql = "SELECT * FROM abc_resource_descriptions WHERE TRIM(resource_code) = '".$this->db->escape($row['value_varchar'])."'";
$r = $this->db->query($sql);
$this->language->load('common/header');
if($r->num_rows){ // update admin menu if resource exists
foreach($r->rows as $re) {
$sql = "UPDATE abc_dataset_values
SET value_varchar='" . $re['resource_id'] . "'
WHERE dataset_column_id=7 AND value_varchar='" . $row['value_varchar'] . "'";
$this->db->query( $sql );
}
}else{
//get item description
$sql = "SELECT * FROM abc_dataset_values WHERE dataset_column_id=2 AND row_id='".$row['row_id']."'";
$md = $this->db->query( $sql )->row['value_varchar'];
$md = 'Menu Item '.$this->language->get($md);
$language_id = $this->language->getContentLanguageID();
$data = array();
$data['resource_code'] = $row['value_varchar'];
$data['name'] = array($language_id => $md);
$data['title'] = array($language_id => $md);
$data['description'] = array($language_id => '');
$resource_id = $rm->addResource($data);
$sql = "UPDATE abc_dataset_values
SET value_varchar='" . $resource_id . "'
WHERE dataset_column_id=7 AND row_id='".$row['row_id']."'";
$this->db->query( $sql );
}
}
//add triggers
//select all tables with date_added
/*
$tables_sql = "
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('date_added')
AND TABLE_SCHEMA='" . DB_DATABASE . "'";
$query = $this->db->query( $tables_sql);
foreach ($query->rows as $t) {
$table_name = $t['TABLE_NAME'];
$triger_name = $table_name . "_date_add_trg";
$triger_checker = $this->db->query("SELECT TRIGGER_NAME
FROM information_schema.triggers
WHERE TRIGGER_SCHEMA = '" . DB_DATABASE . "' AND TRIGGER_NAME = '$triger_name'");
if (!$query->row[0]) {
$sql = "
CREATE TRIGGER `$triger_name` BEFORE INSERT ON `$table_name` FOR EACH ROW
BEGIN
SET NEW.date_added = NOW();
END;
";
$this->db->query($sql);
}
}
*/
//clear cache after upgrade
$this->cache->delete('*');