CodeIgniter Forums
Problem with Shopping Cart class and brackets - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with Shopping Cart class and brackets (/showthread.php?tid=26992)



Problem with Shopping Cart class and brackets - El Forum - 01-28-2010

[eluser]Unknown[/eluser]
I'm having some problems with the Shopping Cart class. When the item name containts brackets (e.g. "Budveiser (US)"), the item doesn't get added to the cart. My code is as follows:

Code:
if ($currentitemquantity>0)
                    {
                        $cart[] = array('id'=>$currentitem, 'qty'=>$currentitemquantity, 'price'=>$currentitemprice, 'name'=>$currentitemdesc, 'options'=>array('unit'=>$currentitemunit));
                    }
                

                $this->cart->insert($cart);

If $currentitemdesc contains brackets the item does not get added. Any ideas how to fix this?


Problem with Shopping Cart class and brackets - El Forum - 01-28-2010

[eluser]Unknown[/eluser]
Ignore that - just seen this.

Should have used the search function Smile