-
Notifications
You must be signed in to change notification settings - Fork 1
/
tab_hikashop_orders.php
107 lines (92 loc) · 3.28 KB
/
tab_hikashop_orders.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* @copyright Copyright (C) 2016 Kyra.lt All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* @package Easy Profile
* website www.easy-profile.com
* Technical Support : Forum - http://www.easy-profile.com/support.html
*/
defined('_JEXEC') or die;
class PlgJsnTab_Hikashop_orders extends JPlugin
{
public function renderTabs($data, $config)
{
$plugin=array(JText::_($this->params->get('tabtitle','Orders')));
$item_id = $this->params->get('item_id','');
$id = JRequest::getInt( 'id', 0 );
$user = JFactory::getUser();
if( $id === 0 && $user->id > 0 )
{
$id = $user->id;
}
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php');
//load order info
$database = JFactory::getDBO();
$searchMap = array('a.order_id','a.order_status');
$filters = array('a.order_user_id='.hikashop_loadUser());
$order = ' ORDER BY a.order_created DESC';
$query = 'FROM '.hikashop_table('order').' AS a WHERE '.implode(' AND ',$filters).$order;
$database->setQuery('SELECT a.* '.$query);
$rows = $database->loadObjectList();
if(empty($rows)){
return;
}
$currencyHelper = hikashop_get('class.currency');
$trans = hikashop_get('helper.translation');
$statuses = $trans->getStatusTrans();
ob_start();
?>
<table class="hikashop_orders adminlist" style="width:100%" cellpadding="1">
<thead>
<tr>
<th class="hikashop_order_number_title title" style="text-align:center;" align="center">
<?php echo JText::_('ORDER_NUMBER'); ?>
</th>
<th class="hikashop_order_date_title title" style="text-align:center;" align="center">
<?php echo JText::_('DATE'); ?>
</th>
<th class="hikashop_order_status_title title" style="text-align:center;" align="center">
<?php echo JText::_('ORDER_STATUS'); ?>
</th>
<th class="hikashop_order_total_title title" style="text-align:center;" align="center">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</th>
</tr>
</thead>
<tbody>
<?php
$k = 0;
for($i = 0,$a = count($rows);$i<$a;$i++){
$row =& $rows[$i];
?>
<tr class="<?php echo "row$k"; ?>">
<td class="hikashop_order_number_value" align="center">
<a href="<?php echo hikashop_completeLink('order&task=show&cid='.$row->order_id.'&Itemid='.$item_id.'&cancel_url='.urlencode(base64_encode(JRoute::_('index.php?option=com_jsn&view=profile')))); ?>">
<?php echo hikashop_encode($row); ?>
</a>
</td>
<td class="hikashop_order_date_value" align="center">
<?php echo hikashop_getDate($row->order_created,'%Y-%m-%d %H:%M');?>
</td>
<td class="hikashop_order_status_value" align="center">
<?php
//get translation
echo $statuses[$row->order_status];
?>
</td>
<td class="hikashop_order_total_value" align="center">
<?php echo $currencyHelper->format($row->order_full_price,$row->order_currency_id);?>
</td>
</tr>
<?php
$k = 1-$k;
}
?>
</tbody>
</table>
<?php
$content = ob_get_clean();
$plugin[]= $content;
return $plugin;
}
}