![]() |
Cart Class limitation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Cart Class limitation (/showthread.php?tid=37053) Pages:
1
2
|
Cart Class limitation - El Forum - 12-25-2010 [eluser]edidiway[/eluser] Hello everybody, I have a problem in using cart class. I build an e-store website where customer can order online from my site. so I used cart class in codeigniter that save the order in session, but it was strange that I only can order 7 items, if there are 7 items on the cart, and I wanna order again, the cart not updated and always only 7 items.. why could this thing can happened? please help me.. I have searched about this but didnt find the solution. thanks before. Cart Class limitation - El Forum - 12-25-2010 [eluser]cereal[/eluser] If you are using CI Session be aware because you are going to save data into a cookie and this can hold only 4KB: http://ellislab.com/codeigniter/user-guide/libraries/sessions.html Cart Class limitation - El Forum - 12-25-2010 [eluser]InsiteFX[/eluser] Use CodeIgniter database Sessions. InsiteFX Cart Class limitation - El Forum - 12-25-2010 [eluser]skunkbad[/eluser] While I've extended my cart class to use $_SESSION, there's nothing in the cart class that would keep you limited to 7 items. It is your code, which you should share so we can help. Cart Class limitation - El Forum - 12-25-2010 [eluser]edidiway[/eluser] Hi, InsiteFX.. Are there any other solution beside using database session? eg. change the limit more than 4Kb. I think 4Kb can hold much data, but I dont know why my cart only hold 7 items here is my code : $product_id = $this->input->post("input_product_id"); $size_id = $this->input->post("input_size_id"); $color_id = $this->input->post("input_color_id"); $qty = $this->input->post("input_qty"); $production_code = $this->Mproduct->get_production_code_detail($product_id, $size_id, $color_id); $data = array( 'id' => $production_code->production_code, 'qty' => $qty, 'price' => $production_code->price, 'name' => $production_code->name, 'options' => array('size' => $production_code->size, 'color' => $production_code->color) ); $this->cart->insert($data); Cart Class limitation - El Forum - 12-26-2010 [eluser]WanWizard[/eluser] The 4Kb limit is a hard limit, set by the browser. You can't do anything about it. Remember that data is stored in the cookie as serialized array, which is then encrypted. Both actions will increase the amount of data sent to the browser. You'll get to 4Kb quite quickly. If you don't want to use database sessions (why not?), you could use the native sessions library, which uses PHP's standard sessions. Note that on shared hosts, this is not secure. Cart Class limitation - El Forum - 12-26-2010 [eluser]edidiway[/eluser] Hi WanWizard, thanks for your advise, but finally I choose to use database session.. hehe.. I just dont know that 4Kb is set by the browser ![]() ![]() but I think save the session on database is the good solution now. thanks for the help all. Cart Class limitation - El Forum - 12-26-2010 [eluser]InsiteFX[/eluser] The 4Kb Cookie is set by the web browser there is nothing that you can do about! It has nothing to do with CI. InsiteFX Cart Class limitation - El Forum - 12-26-2010 [eluser]skunkbad[/eluser] [quote author="WanWizard" date="1293384021"]... you could use the native sessions library, which uses PHP's standard sessions. Note that on shared hosts, this is not secure.[/quote] This is not entirely true. The session_save_path() function can set the location of the session data to anywhere, and if you choose a location within your exclusive hosting account but above what is publicly accessible, then as far as I'm concerned this is secure. Am I wrong? Cart Class limitation - El Forum - 12-27-2010 [eluser]WanWizard[/eluser] Some hosters allow you to do that, some don't. If you can store session files within your personal disk space, than it is more secure (taking the assumption that those who can access your part of the disk can also access your database). |