Skip to content

Commit ca7abd6

Browse files
committed
feat: set currency by iso
1 parent 3324ed5 commit ca7abd6

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

controllers/AbstractCartRESTController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ abstract class AbstractCartRESTController extends CartControllerCore {
88
public function init()
99
{
1010
header('Content-Type: ' . "application/json");
11+
12+
if (Tools::getValue('iso_currency')){
13+
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
14+
$_GET['SubmitCurrency'] = "1";
15+
}
16+
1117
parent::init();
18+
1219
switch ($_SERVER['REQUEST_METHOD']) {
1320
case 'GET':
1421
$this->processGetRequest();

controllers/AbstractPaymentRESTController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ abstract class AbstractPaymentRESTController extends ModuleFrontController
2020
public function init()
2121
{
2222
header('Content-Type: ' . "application/json");
23+
24+
if (Tools::getValue('iso_currency')){
25+
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
26+
$_GET['SubmitCurrency'] = "1";
27+
}
28+
2329
if (!$this->context->customer->isLogged() && $this->php_self != 'authentication' && $this->php_self != 'password') {
2430
$this->ajaxRender(json_encode([
2531
'code' => 410,

controllers/AbstractProductListingRESTController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ abstract class AbstractProductListingRESTController extends ProductListingFrontC
2929
public function init()
3030
{
3131
header('Content-Type: ' . "application/json");
32+
33+
if (Tools::getValue('iso_currency')){
34+
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
35+
$_GET['SubmitCurrency'] = "1";
36+
}
37+
3238
parent::init();
39+
3340
switch ($_SERVER['REQUEST_METHOD']) {
3441
case 'GET':
3542
$this->processGetRequest();

controllers/AbstractRESTController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ abstract class AbstractRESTController extends ModuleFrontController
2222
public function init()
2323
{
2424
header('Content-Type: ' . "application/json");
25+
26+
if (Tools::getValue('iso_currency')){
27+
$_GET['id_currency'] = (string)Currency::getIdByIsoCode(Tools::getValue('currency'));
28+
$_GET['SubmitCurrency'] = "1";
29+
}
30+
2531
parent::init();
32+
2633
switch ($_SERVER['REQUEST_METHOD']) {
2734
case 'GET':
2835
$this->processGetRequest();

0 commit comments

Comments
 (0)