blob: 441669d0f0ccff57f5ee45ef785d38bd7f6e8d90 (
plain)
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
|
<?php
class ControllerCommonCurrency extends Controller {
public function index() {
$this->load->language('common/currency');
$data['action'] = $this->url->link('common/currency/currency', '', $this->request->server['HTTPS']);
$data['code'] = $this->session->data['currency'];
$this->load->model('localisation/currency');
$data['currencies'] = array();
$results = $this->model_localisation_currency->getCurrencies();
foreach ($results as $result) {
if ($result['status']) {
$data['currencies'][] = array(
'title' => $result['title'],
'code' => $result['code'],
'symbol_left' => $result['symbol_left'],
'symbol_right' => $result['symbol_right']
);
}
}
if (!isset($this->request->get['route'])) {
$data['redirect'] = $this->url->link('common/home');
} else {
$url_data = $this->request->get;
unset($url_data['_route_']);
$route = $url_data['route'];
unset($url_data['route']);
$url = '';
if ($url_data) {
$url = '&' . urldecode(http_build_query($url_data, '', '&'));
}
$data['redirect'] = $this->url->link($route, $url, $this->request->server['HTTPS']);
}
return $this->load->view('common/currency', $data);
}
public function currency() {
if (isset($this->request->post['code'])) {
$this->session->data['currency'] = $this->request->post['code'];
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
}
if (isset($this->request->post['redirect'])) {
$this->response->redirect($this->request->post['redirect']);
} else {
$this->response->redirect($this->url->link('common/home'));
}
}
}
|