![]() |
Code igniter shopping cart class working but not working - 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: Code igniter shopping cart class working but not working (/showthread.php?tid=49159) |
Code igniter shopping cart class working but not working - El Forum - 02-09-2012 [eluser]canado[/eluser] I m using the shopping cart class I have session loaded I don t use special characters in the name I m inserting few articles everything is fine. But at some point I have a problem. So I did some tests, right after the problem occurred. I add another item (manually); when I do a var_dump($this->cart->contents()); just after the insert I can see it is there. it's even returning a bool(true) but if I do just a var_dump($this->cart->contents()) to re-check not even 1 sec later, the item I just inserted, disappeared !!!! Has any one encountered the same problem? when I destroy the cart everything is back to normal until I add 3 4 items, then the same problem is happening. Code igniter shopping cart class working but not working - El Forum - 02-09-2012 [eluser]CroNiX[/eluser] Are you using cookies or database for storing your sessions? Code igniter shopping cart class working but not working - El Forum - 02-10-2012 [eluser]canado[/eluser] I dont really know I just do a $this->load->library('session'); but I think the less data I store, the more items I can add into the cart before having this issue. If I want to store the data I need I can add up to 4 max 5 items, if I add only one letter per object inside the array I can add up to 10-12 items any idea? Code igniter shopping cart class working but not working - El Forum - 02-10-2012 [eluser]canado[/eluser] To make sure the error was not from my own data, I m doing this Code: [php] even with this, I m stuck at 11 items!! Code igniter shopping cart class working but not working - El Forum - 02-10-2012 [eluser]mast3rpyr0[/eluser] It seems like you are running out of space in your cookie to use. IIRC you only have about 4 bytes of data to store. What you can do is only store the product id of an item in the cookie, and then in your cart page, just have it hit the database to get the rest of the data of that item. If you do that hopefully that will at least triple the number of items you can have. If you need more than that then idk what to tell ya. I've never used the cart class before so I could not understand something about it correctly. Code igniter shopping cart class working but not working - El Forum - 02-10-2012 [eluser]canado[/eluser] Ok so I ve check in config.php I m not using a DB it's a cookie. I thought I could store up to 4ko and not just 4 bytes inside a cookie. So I don't understand why my cart is limited so fast. And as you can see in my previous post, just to test, I m only storing the id and still I m limited to 11 items I ll try to check if I can change the cookie size or use a DB, or use my own table in DB Code igniter shopping cart class working but not working - El Forum - 02-10-2012 [eluser]mast3rpyr0[/eluser] Sorry, 4Kb is correct. See if you can find an extension or something to see how much data you are using. In your test you stored qty, price and name as well. If it allows you, try only the ID. Code igniter shopping cart class working but not working - El Forum - 02-10-2012 [eluser]canado[/eluser] I can't Here is what they says in the DOC The first four array indexes above (id, qty, price, and name) are required. If you omit any of them the data will not be saved to the cart. The fifth index (options) is optional. It is intended to be used in cases where your product has options associated with it. Use an array for options, as shown above. Code igniter shopping cart class working but not working - El Forum - 02-10-2012 [eluser]canado[/eluser] ok it seems to work with the DB, I ll continue my tests |