Arrays in Sessions

2007-11-25 Thread ohneworte
Good Evening! I want to create a basket for a simple shop. The chosen product should be stored into a session-variable until the checkout procedure. I am asking if it (and how!) it is possible to store an array in a cake-session? As an Example: the user puts the first object into his basket:

Re: Arrays in Sessions

2007-11-25 Thread Grant Cox
// get the current basket $basket = $this-Session-read('basket'); if ( empty($basket) ){ $basket = array(); } // modify it how you like $basket[] = $new_product; // save back to session $this-Session-write( 'basket', $basket ); On Nov 26, 8:08 am, ohneworte [EMAIL PROTECTED] wrote: Good

Re: Arrays in sessions.

2006-06-14 Thread Mike
If you want to add to the array without using a key you can use: $this-Session-write('myarray\'][][\'', 'myvalue' ); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email

Re: Arrays in sessions.

2006-06-11 Thread DJ Spark
In the views , you may use $this-controller-Session-read('Transaccion'); spark On 6/10/06, Carlos Mauricio Samour [EMAIL PROTECTED] wrote: Well I just answered my own question by doing this: $this-set('data', $this-Session-read('Transaccion')); Once againg: CAKE RULES! On 6/10/06,

Re: Arrays in sessions.

2006-06-10 Thread Carlos Mauricio Samour
Well I just answered my own question by doing this: $this-set('data', $this-Session-read('Transaccion')); Once againg: CAKE RULES! On 6/10/06, Carlos Mauricio Samour [EMAIL PROTECTED] wrote: On the wiki I read that if you wanted to save an array with the session component you do this: