aboutsummaryrefslogtreecommitdiffstats
path: root/public/catalog/controller/api/currency.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/catalog/controller/api/currency.php')
-rw-r--r--public/catalog/controller/api/currency.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/public/catalog/controller/api/currency.php b/public/catalog/controller/api/currency.php
new file mode 100644
index 0000000..3e9ca09
--- /dev/null
+++ b/public/catalog/controller/api/currency.php
@@ -0,0 +1,30 @@
+<?php
+class ControllerApiCurrency extends Controller {
+ public function index() {
+ $this->load->language('api/currency');
+
+ $json = array();
+
+ if (!isset($this->session->data['api_id'])) {
+ $json['error'] = $this->language->get('error_permission');
+ } else {
+ $this->load->model('localisation/currency');
+
+ $currency_info = $this->model_localisation_currency->getCurrencyByCode($this->request->post['currency']);
+
+ if ($currency_info) {
+ $this->session->data['currency'] = $this->request->post['currency'];
+
+ unset($this->session->data['shipping_method']);
+ unset($this->session->data['shipping_methods']);
+
+ $json['success'] = $this->language->get('text_success');
+ } else {
+ $json['error'] = $this->language->get('error_currency');
+ }
+ }
+
+ $this->response->addHeader('Content-Type: application/json');
+ $this->response->setOutput(json_encode($json));
+ }
+}