Jump to content

problems with cookies or currency


Recommended Posts

i'm testing with iso vi and i'm trying to get correct cookie->id_currency after page reload.

 

here is my code.

 

$url_currency_code = Tools::getValue('isolang');

if($url_currency_code=='es')
 $url_currency_id = 1;
if($url_currency_code=='vi')
 $url_currency_id = 2;

echo $cookie->id_currency; // display 1 or 2

//$cookie->id_currency = 2; // this work
$cookie->id_currency = $url_currency_id; // but this not work (i am sure $url_currency_id is 2)
$currency = Tools::setCurrency();
echo $cookie->id_currency; // display 2

 

the problem is first $cookie->id_currency, the second is ok.

the problem is very strange how program work with (2) but not with variable setted from $_GET with the same value and type.

Link to comment
Share on other sites

the problem is when i set it from Tools::getValue('isolang'); to be 2, cookie->id_currency after refresh is 1 not 2. But when i test to set it directly //$cookie->id_currency = 2; not from variable it work. I want to set it from Tools::getValue('isolang'); or $_GET['isolang'] . Looks crazy, i don't know what is the problem with setting from variable that is from $_GET not directly. I try with (int) and (string) casting but with no effect.

Link to comment
Share on other sites

×
×
  • Create New...