From 15002099a876b42a606885b14689034ffae59d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=93=20Ng=E1=BB=8Dc=20Tri=E1=BB=83n?= Date: Tue, 25 Aug 2015 10:26:23 +0700 Subject: [PATCH 1/3] Update custom field --- modules/shops/admin.functions.php | 2 -- modules/shops/admin/content.php | 1 - modules/shops/admin/field_tab.php | 28 +++++++++++++------ modules/shops/functions.php | 15 ++-------- modules/shops/language/admin_vi.php | 14 ++++------ modules/shops/theme.php | 4 +-- .../admin_default/modules/shops/field_tab.tpl | 3 +- .../default/modules/shops/tab_introduce.tpl | 2 -- 8 files changed, 31 insertions(+), 38 deletions(-) delete mode 100644 themes/default/modules/shops/tab_introduce.tpl diff --git a/modules/shops/admin.functions.php b/modules/shops/admin.functions.php index ecbcdefb5..f6c641d4c 100644 --- a/modules/shops/admin.functions.php +++ b/modules/shops/admin.functions.php @@ -1191,10 +1191,8 @@ function nv_show_custom_form( $is_edit, $form, $array_custom ) * @param mixed $idshop * @return */ - function Insertabl_catfields( $table, $array, $idshop ) { - global $db, $module_name, $module_file, $db, $link, $module_info, $global_array_shops_cat, $global_config; $result = $db->query( "SHOW COLUMNS FROM " . $table ); diff --git a/modules/shops/admin/content.php b/modules/shops/admin/content.php index da64f3846..7602d6966 100644 --- a/modules/shops/admin/content.php +++ b/modules/shops/admin/content.php @@ -574,7 +574,6 @@ $idtemplate = $db->query( 'SELECT id FROM ' . $db_config['prefix'] . '_' . $module_data . '_template where alias = "' . preg_replace( "/[\_]/", "-", $global_array_shops_cat[$rowcontent['listcatid']]['form'] ) . '"' )->fetchColumn( ); $table_insert = $db_config['prefix'] . "_" . $module_data . "_info_" . $idtemplate; - Insertabl_catfields( $table_insert, $array_custom, $rowcontent['id'] ); } if( !empty( $rowcontent['group_id'] ) ) diff --git a/modules/shops/admin/field_tab.php b/modules/shops/admin/field_tab.php index 5abc48f67..8c556f599 100644 --- a/modules/shops/admin/field_tab.php +++ b/modules/shops/admin/field_tab.php @@ -13,7 +13,7 @@ $table_name = $db_config['prefix'] . '_' . $module_data . '_tabs'; $arr_tab = array( ); -$arr_tab['introduce'] = $lang_module['status_1']; +$arr_tab['introduce'] = 'introduce'; $sql = 'SELECT * FROM ' . $table_name . ' where content = ' . $db->quote( 'content_customdata' ) . ' ORDER BY weight ASC'; $result = $db->query( $sql ); $field_lang = nv_file_table( $table_name ); @@ -87,11 +87,15 @@ if( $show_view ) { - foreach( $arr_tab as $key => $value ) + $arr_tab_tmp = $arr_tab; + $arr_tab_tmp['introduce'] = $lang_module['field_info_list']; + foreach( $arr_tab_tmp as $key => $value ) { $xtpl->assign( 'title_tab', $value ); $xtpl->parse( 'main.view.title_tab' ); } + unset( $arr_tab_tmp ); + while( $view = $sth->fetch( ) ) { $arr_display_tab = unserialize( $view['tab'] ); @@ -180,16 +184,22 @@ } } } + foreach( $arr as $key => $value )// loai bo phan tu trung nhau { $arr_tab_tpl[$key] = array_unique( $value ); } - file_put_contents( NV_ROOTDIR . '/themes/default/modules/' . $module_file . '/tab_introduce.tpl', '', LOCK_EX ); + + if( !file_exists( NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/' . $module_name . '/files_tpl' ) ) + { + nv_mkdir( NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/' . $module_name, 'files_tpl' ); + } + foreach( $arr_tab_tpl as $key => $value ) { - $name_file = 'tab_' . str_replace( '-', '_', strtolower( change_alias( $arr_tab[$key] ) ) ) . '.tpl'; + $name_file = 'tab-' . strtolower( change_alias( $arr_tab[$key] ) ) . '-' . NV_LANG_DATA . '.tpl'; $html_tpl = "\n"; - $html_tpl .= "\t