简体   繁体   中英

php page refresh once - opencart

im having a problem in my opencart website. i always want the customer who set delivery address non malaysia to always pay in USD.

the problem is they will choose MYR and choose non malaysia country and pay.

so i applied the below at catalog/controller/checkout/checkout.php

     $this->currency->set('MYR'); 
     if ($_SESSION['shipping_zone_id'] == '3528'){ 
     $this->currency->set('USD');
     }

the problem is for currency to go into session, it needed a page refresh, so i applied the below :

     $this->currency->set('MYR'); 
     if ($_SESSION['shipping_zone_id'] == '3528'){ 
     $this->currency->set('USD');
     $sec = "10";
     header("Refresh: $sec; url=index.php?route=checkout/checkout");
     }

the above yes refreshing the page, but it keep on refreshing the page. i want it to refresh only once. plz advice

Add the lines of of code below

$this->currency->set('MYR'); 
 if ($_SESSION['shipping_zone_id'] == '3528'){ 
 $this->currency->set('USD');


 if(!empty($_GET['refresh']) && $_GET['refresh'] == 0 ){} //add this
else{

 $sec = "10";
 header("Refresh: $sec; url=index.php?refresh=0&route=checkout/checkout");

 } //and close it here

 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM