Skip to content

Commit

Permalink
Fix change template groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Hồ Ngọc Triển committed Aug 25, 2015
1 parent 0825fe2 commit 5a38383
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions modules/shops/admin/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@

$data['title'] = nv_substr( $nv_Request->get_title( 'title', 'post', '' ), 0, 50 );
$data['alias'] = strtolower( change_alias( $data['title'] ) );
$stmt = $db->query( 'SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_template where alias=' . $db->quote( $data['alias'] ) )->fetchColumn( );

if( empty( $data['title'] ) )
$count = $db->query( 'SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_template where alias=' . $db->quote( $data['alias'] ) . ' AND id!=' . $data['id'] )->fetchColumn();
if( $count > 0 )
{
$error = $lang_module['template_error_name'];
$_tem_id = $db->query( 'SELECT MAX(id) FROM ' . $db_config['prefix'] . '_' . $module_data . '_template WHERE alias=' . $db->quote( $data['alias'] ) )->fetchColumn();
$data['alias'] = $data['alias'] . '-' . $_tem_id;
}
elseif( !empty( $stmt ) )

if( empty( $data['title'] ) )
{
$error = $lang_module['block_error_alias'];
$error = $lang_module['template_error_name'];
}

else
{
if( $data['id'] == 0 )
Expand Down

0 comments on commit 5a38383

Please sign in to comment.