I'm sorry, $this->getUser()->getShoppingCart()->clear(); works perfectly!
I just had an error on the route and it didn't execute the correct action, it was executing the index. Thanks a lot for your help!!! On 8 jul, 10:10, snakemaycry <snakemay...@gmail.com> wrote: > HI > > I haven't been using sfShoppingCart for a while, but I've managed to > find my code written in Symfony 1.0.x and there I've cleared the cart > with code: > > $this->getUser()->getShoppingCart()->clear(); > > Hope that helps. > > Regards > PM > > On Jul 7, 10:49 pm, despuestambien <carrau.alejan...@gmail.com> wrote: > > > > > I don't if anyone at all is using the plugin sfShoppingCart, but if > > anyone is, would someone know how to empty the cart? > > > I keep creating new instances on the setAttribute function on the > > user, calling the ->clear() function, which does nothing, and even > > rewriting that method for trying to change something. > > > /** > > * Removes all items from the shopping cart. > > */ > > public function clear() > > { > > foreach($this->items as $item) > > { > > $item->setShoppingCart(null); > > $item->clear(); > > } > > $this->items = array(); > > } > > > But the only way I can empty the cart is by emptying the cookies. > > Adding new items works fine. > > > Can anyone help me? > > > Thanks a lot in advance. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en