I worked on a similar problem. I have not made a component (yet) But this is what I did. First on the controller I checked if the session data for my invoice header data was stored. I am new at cake. if (!$this->Session->check('documentoventa')) { $sucursal = $this->Session->read('Sucursal'); $usuario = $this->Session->read('User'); $Documentoventa['fecha'] = $this->Session->read('Fecha'); $Documentoventa['numero_documento'] = $correlativo['Correlativo']['correlativo']; $Documentoventa['tipodocumentoventa_id'] = 1; $Documentoventa['bodega_id'] = $sucursal['Bodega']['0']['id']; $Documentoventa['cajero_id'] = $usuario['id']; $this->Session->write('Documentoventa', $Documentoventa); } $this->set('documentoventa', $this->Session->read('Documentoventa')); $this->set('data', $this->Session->read('Transaccion')); $this->render(); Then when I want to save de products I did this.
if (!empty($this->params['data'])){ if (!$this->Session->check('Transaccion')){ $this->Session->write( 'Transaccion\'][\'0' , $this->params['data']['Transaccion']); $this->Session->write('numero_transaccion', 0); } $numero_transaccion = $this->Session->read('numero_transaccion'); $numero_transaccion++; $this->Session->write( 'Transaccion\'][\''.$numero_transaccion , $this->params['data']['Transaccion']); $this->Session->write('numero_transaccion', $numero_transaccion); $this->set('data', $this->Session->read('Transaccion')); } $this->render('fact_detalle', 'ajax'); Again I am new at cake and most probably you could optimize this code. I bases my selft loosely on the example in the wiki. http://wiki.cakephp.org/docs:session. Hope that helps. Let me know what you did I apreciate it. On 6/10/06, brandags <[EMAIL PROTECTED]> wrote: > > I'm trying to make a simple shopping cart - just basically a way to > store product id's in the session, and maybe a function that calls a > view to display the cart. > > Should I be doing this as a regular controller, or should I make a > component for it? Either way, how can I make the cart (as well as the > displayCart() function, etc.) persist in the session? What is the best > way to do this? > > Thank you, > Brandon > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---