![]() |
Cart - insert (add) item - how do you get the generated rowid? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Cart - insert (add) item - how do you get the generated rowid? (/showthread.php?tid=40950) |
Cart - insert (add) item - how do you get the generated rowid? - El Forum - 04-23-2011 [eluser]YangHax[/eluser] I want to get the rowid of the item at the point of me calling $this->cart->insert(...) Is there a way to accomplish this, without hacking up core/libraries/cart.php? Thanks! Cart - insert (add) item - how do you get the generated rowid? - El Forum - 04-23-2011 [eluser]YangHax[/eluser] For now, I accomplished this by hacking up the library and setting the $items parameter in insert() and _insert() to be passed by reference, and then setting $items['rowid'] = $rowid; ...right before return of _insert() This way, I get the rowid back in the same array that I passed to insert() Please let me know if there are any negative implication to this approach, though it seems to be working good at first glance. |