user_account.php
3.01 KB
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
<?php
/**
* @copyright OCTemplates
* @support https://octemplates.net/
* @license LICENSE.txt
*/
class ControllerOCTemplatesEventsUserAccount extends Controller {
public function userFront(&$route, &$data) {
$data['download_view'] = $this->config->get('module_account_download_view');
$data['recurring_view'] = $this->config->get('module_account_recurring_view');
$data['reward_view'] = $this->config->get('module_account_reward_view');
$data['return_view'] = $this->config->get('module_account_return_view');
$data['transaction_view'] = $this->config->get('module_account_transaction_view');
$data['newsletter_view'] = $this->config->get('module_account_newsletter_view');
$data['affiliate_view'] = $this->config->get('module_account_affiliate_view');
$data['oct_stock_notifier_status'] = $this->config->get('oct_stock_notifier_status');
$data['oct_stock_notifier'] = $this->url->link('account/oct_stock_notifier', '', true);
if ($this->customer->isLogged()) {
$this->load->model('account/customer');
$affiliate_info = $this->model_account_customer->getAffiliate($this->customer->getId());
if (!$affiliate_info) {
$data['affiliate'] = $this->url->link('account/affiliate/add', '', true);
$data['tracking'] = '';
} else {
$data['affiliate'] = $this->url->link('account/affiliate/edit', '', true);
$data['tracking'] = $this->url->link('account/tracking', '', true);
}
} else {
$data['affiliate'] = $this->url->link('affiliate/login', '', true);
}
}
public function accountPageInfo(&$route, &$data) {
$customer_info = $this->model_account_customer->getCustomer($this->customer->getId());
$data['email'] = $customer_info['email'];
$data['firstname'] = $customer_info['firstname'];
$data['url_contacts'] = $this->url->link('information/contact', '', true);
$data['orders'] = [];
$this->load->model('account/order');
$order_total = $this->model_account_order->getTotalOrders();
$page = 1;
$results = $this->model_account_order->getOrders(($page - 1) * 10, 10);
foreach ($results as $result) {
$product_total = $this->model_account_order->getTotalOrderProductsByOrderId($result['order_id']);
$voucher_total = $this->model_account_order->getTotalOrderVouchersByOrderId($result['order_id']);
$data['orders'][] = [
'order_id' => $result['order_id'],
'status' => $result['status'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
'href' => $this->url->link('account/order/info', 'order_id=' . $result['order_id'], 'SSL'),
];
}
}
}