Welcome Guest, Not a member yet? Register   Sign In
cookie issue, can you help me?
#1

(This post was last modified: 03-27-2020, 10:29 AM by jreklund.)

hello
sorry for my english, i have an unknow issue on my website:

i try to save a cart in a cookie:

var_dump of the cookie before saving :

Code:
array (size=3)
'name' => string 'cart'
'value' => string '[{"id":"13991","id_prod":"18176","qty":1,"gravure":"","options_infos":[],"cadeau":0},{"id":"13983","id_prod":"18168","qty":1,"gravure":"","options_infos":[],"cadeau":0},{"id":"13987","id_prod":"18172","qty":1,"gravure":"","options_infos":[],"cadeau":0},{"id":"279543","id_prod":"29990","qty":1,"gravure":"","options_infos":[],"cadeau":0},{"id":"279554","id_prod":"30001","qty":1,"gravure":"","options_infos":[],"cadeau":0},{"id":"279539","id_prod":"29986","qty":1,"grav ure":"","options_infos":[],"cadeau":0},{"id'... (length=3301)
'expire' => int 2592000



this php function is triggerered on my page to update the cookie cart,
this is what is blocking when i have more than approx  20 items on my cart


PHP Code:
public function refreshCookie() {
$items = array();
if (
parent::contents()) {
foreach (
parent::contents() as $key => $value) {

$prod = new stdClass();

$prod->id $value['id'];
$prod->id_prod $value['id_prod'];
$prod->qty $value['qty'];

if (isset(
$value['gravure'])){
$prod->gravure $value['gravure'];

if (isset(
$value['options_infos'])){
$prod->options_infos $value['options_infos'];
}
$prod->cadeau $value['cadeau'];
$items[] = $prod;
}
}

$cookie = array(
'name' => 'cart',
'value' => json_encode($items),
'expire' => $this->CI->config->item('cookie_panier_lifetime')
);
$this->CI->input->set_cookie($cookie);


this work fine in my local machine but not online when i have more than 20 items
it wotk if i remove the set_cookier line ($this->CI->input->set_cookie($cookie);)
also note that if i use the php setcookie it is the same, so it is not realy a codeigniter issue :/


i don't understand , any help would be appreciated
regards
Reply


Messages In This Thread
cookie issue, can you help me? - by michaelvuillermoz - 03-27-2020, 10:25 AM
RE: cookie issue, can you help me? - by jreklund - 03-27-2020, 11:15 AM
RE: cookie issue, can you help me? - by jreklund - 03-28-2020, 04:12 AM
RE: cookie issue, can you help me? - by InsiteFX - 03-28-2020, 08:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB