CodeIgniter Forums

Full Version: Cart - Cookie problem (size of cart)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]mallix[/eluser]
I have implemented the Cart Class to support my project but I have problems with the size of it as we already know that a cookie is not supposed to be more than 4 Kb.

Also I have my cookie encrypted so add the size of it too.

My product looks like this:
'id' => 'product_id'
'qty' => 'quantity'
'price' => 'price'
'name' => 'product_name'
'options' => array(
'variation' => 'variation_id',
'components' => 'component_id1,component_id2...'
)

Which is the way to implement the Cart Class avoiding the cookie limit when the Cart itself is using a cookie to function.

For now I can only store 3 to 4 products with variations and components but what is the purpose of implementing a Cart Class in a CI project if somehow you can t have "unlimited" products in the cart.

Thank you!

El Forum

[eluser]mallix[/eluser]
Ok that is strange.

Using ONLY Ids to keep track of the products in cart WITHOUT any options I get this from contents() :

({c4ca4238a0b923820dcc509a6f75849b:{rowid:"c4ca4238a0b923820dcc509a6f75849b", id:"1", qty:"1", price:"9.99", name:"1", subtotal:9.99}, c81e728d9d4c2f636f067f89cc14862c:{rowid:"c81e728d9d4c2f636f067f89cc14862c", id:"2", qty:"1", price:"9.99", name:"2", subtotal:9.99}, eccbc87e4b5ce2fe28308fd9f2a7baf3:{rowid:"eccbc87e4b5ce2fe28308fd9f2a7baf3", id:"3", qty:"1", price:"9.99", name:"3", subtotal:9.99}, a87ff679a2f3e71d9181a67b7542122c:{rowid:"a87ff679a2f3e71d9181a67b7542122c", id:"4", qty:"1", price:"9.99", name:"4", subtotal:9.99}})

I cannot add any other product to the cart probably due to cookie limitations but even if I used a database to track the options via the rowid..

A little help would be great as I can see that something is missing in the Cart Class ..

El Forum

[eluser]mallix[/eluser]
Another questions that occurs.

Is there a way for the cart to be the only feature using the database to store the options rather than CI sessions ?

Other features like user email and logging in I want those in CI sessions and not in database.

Thank you

El Forum

[eluser]mallix[/eluser]
I guess I will have to use the database for the headache to be over.