Last active
October 20, 2017 09:27
-
-
Save sashabeep/234034b2bd5aa8422d4b8fe789d8a13c to your computer and use it in GitHub Desktop.
Evoshop view orders module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(IN_MANAGER_MODE!='true' && !$modx->hasPermission('exec_module')) die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODX Content Manager instead of accessing this file directly.'); | |
$moduleurl = 'index.php?a=112&id='.$_GET['id'].'&'; | |
$txt = $modx->runSnippet('DocLister', array( 'controller' => 'onetable', | |
'table' => 'evoshop_orders', | |
'idField' => 'id', | |
'tpl' => '@CODE:<tr><td>[+id+]</td><td>[+orderdata+]</td><td><b>[+price+]</b></td><td>[+date+]</td><td>[+email+]</td><td>[+phone+]</td><td align="center"><a href="'.$moduleurl.'action=remove&eid=[+id+]"><i class="fa fa-trash-o"></i></a></td></tr>', | |
'orderBy'=>'id ASC', | |
'selectFields'=>'id,price,date,email,phone,content', | |
'showParent'=>'-1', | |
'idType'=>'documents', | |
'ignoreEmpty'=>'1', | |
'prepare'=>'shoptable_prepare' | |
)); | |
switch ($_GET['action']) { | |
case 'remove': | |
$id = intval($_REQUEST['eid']); | |
$table = $modx->getFullTableName('evoshop_orders'); | |
$sql = "delete from $table where id=$id"; | |
$result = $modx->db->query($sql); | |
if ($result){ | |
header( 'Location: '.$moduleurl.'delete=success', true, 301 ); | |
} else { | |
header( 'Location: '.$moduleurl.'delete=fail', true, 301 ); | |
} | |
break; | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Просмотр заказов</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width"> | |
<meta name="theme-color" content="#1d2023"> | |
<link rel="stylesheet" type="text/css" href="media/style/default/style.css?v=1.3.6"> | |
<link rel="stylesheet" type="text/css" href="media/style/common/font-awesome/css/font-awesome.min.css?v=4.7.0"> | |
<script src="media/script/jquery/jquery.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div class="container container-body"> | |
<h1>Инфомация о заказах</h1> | |
<p>Внимание! Удаление заказа невозможно отменить!</p> | |
<? if ($_GET['delete']){ | |
switch ($_GET['delete']) { | |
case 'success': | |
$message='Запись удалена успешно'; | |
break; | |
case 'fail': | |
$message='Чет не очень вышло'; | |
break; | |
} | |
echo "<p>$message</p>"; | |
}?> | |
<table width="100%" class="sortabletable"> | |
<thead> | |
<tr> | |
<th width="1">id</th> | |
<th>Содержание</th> | |
<th>Стоимость</th> | |
<th>Дата</th> | |
<th>E-mail</th> | |
<th>Телефон</th> | |
<th></th> | |
</tr> | |
</thead> | |
<tbody> | |
<? echo $txt;?> | |
</tbody> | |
</table> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment