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:
<?php
function order_list($obj, $tip, $uid = null) {
$tr = null;
if ($tip == 1)
$where = array('user' => '=' . $obj->UsersId);
elseif ($tip == 2 and !empty($uid))
$where = array('uid' => '="' . htmlspecialchars($uid) . '"');
$PHPShopOrm = new PHPShopOrm($obj->getValue('base.orders'));
$data = $PHPShopOrm->select(array('*'), $where, array('order' => 'datas desc'), array('limit' => 100));
$PHPShopOrderFunction = new PHPShopOrderFunction(false);
$currency = $PHPShopOrderFunction->default_valuta_code;
$PHPShopOrderStatusArray = new PHPShopOrderStatusArray();
if (is_array($data))
foreach ($data as $row) {
$PHPShopOrderFunction->import($row);
if ($tip == 1)
$link = "?order_info=" . $row['uid'] . "#Order";
else
$link = "/users/register.html";
$td1 = PHPShopText::a($link, $row['uid'], $obj->lang('order_info') . $row['uid'], false, false, false, 'text-primary');
$td2 = PHPShopDate::dataV($row['datas']);
$td3 = $PHPShopOrderFunction->getNum();
$td4 = '' . $PHPShopOrderFunction->getDiscount();
$td5 = $PHPShopOrderFunction->getTotal() . ' ' . $currency;
$td6 = PHPShopText::b($PHPShopOrderFunction->getStatus($PHPShopOrderStatusArray), 'color:' . $PHPShopOrderFunction->getStatusColor($PHPShopOrderStatusArray));
$tr.=$obj->tr($td1, $td2, $td3, $td4, $td5, $td6);
}
$caption = $obj->caption($obj->lang('order_table_title_1'), $obj->lang('order_table_title_2'), $obj->lang('order_table_title_3'), $obj->lang('order_table_title_4'), $obj->lang('order_table_title_5'), $obj->lang('order_table_title_6'));
if (!empty($tr))
$table = PHPShopText::table($caption . $tr, 3, 1, 'center', '100%', false, 0, 'order-list', 'list table table-striped table-bordered table-hover');
else
$table = __("");
$obj->set('formaTitle', $obj->lang('user_order_title'));
$obj->set('formaContent', $table);
}
?>