![]() |
Cart Class does not return the item when price is zero - 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 Class does not return the item when price is zero (/showthread.php?tid=42412) |
Cart Class does not return the item when price is zero - El Forum - 06-06-2011 [eluser]chikoi[/eluser] Hi. I'm using the Cart Class to handle my items (some of there are priced as 0), however, the cart does not return the item being priced as zero. Is there any simple and quick workaround for this? Thanks. Cart Class does not return the item when price is zero - El Forum - 06-06-2011 [eluser]chikoi[/eluser] NVM, i figured this out! You have to comment out or apply some changes on line 197 of system/libraries/Cart.php Code: //$items['price'] = trim(preg_replace('/(^[0]+)/i', '', $items['price'])); Hope this helps someone having the same issue. =) Cart Class does not return the item when price is zero - El Forum - 06-10-2011 [eluser]nomikos3[/eluser] Hi, thanks for guide me to that file. Code: // Prep the price. Remove anything that isn't a number or decimal point. So to avoid hack the core it's preferable use 0.00 instead 0 (zero). Cart Class does not return the item when price is zero - El Forum - 06-11-2011 [eluser]InsiteFX[/eluser] You should extend a Core Class not modify it! InsiteFX Cart Class does not return the item when price is zero - El Forum - 06-12-2011 [eluser]chikoi[/eluser] Hi NomikOS3 and InsiteFX, Thanks for the heads up. I'll go ahead and extend the class instead of modifying it. |