Welcome Guest, Not a member yet? Register   Sign In
Shopping Cart library 5 item limit, weird problem

Hey Everyone -

I'm using the CI cart library and it seems to work fine but after I had 5 items it just craps out. Even if I remove an item it won't let me add another. I have to remove all of the items or destroy the cart to get it working again. I can't, for the life of me, figure out what is going on. I have tried loading up an array with multiple items and that doesn't work either. Any ideas of where to even start sorting this out would be appreciated.

Thanks in advance!


[eluser]Cristian Gilè[/eluser]
Hi cityzen, provide us your code.

Cristian Gilè

Thanks for the fast reply...

*I just did some crossbrowser testing before I replied and it seems to work fine on Safari and Firefox so the issue seems to be Chrome, unfortunately*

I've been doing more testing and thought I confirmed that my items were limited to 5 but somehow got six into the cart somehow (cannot replicate this). This code is used to add a sample of a product to a cart. The fetch method is grabbing the info.

function add_sample()
        $sample = $this->Product_model->fetch('variation', $this->uri->segment(3));
        $sample_price = ($sample[0]->sample_price > 0) ? $sample[0]->sample_price : $this->sample_price;
        $data = array(
            'id'    => 'SMPL-' . $sample[0]->id,
            'qty'    => 1,
            'price'    => $sample_price,
            'name'    => 'Product Sample'
        header('Location: /cart/');

While testing I set up a page where I was adding items to the cart and echoing out the $this->session->userdata('cart_contents'); and it seems like after the 5th product, all new products just replace the last one.

Are you using a database to store session data or cookie? cookie has a size limitation. This is a common problem people have.

Just switched over to database, seems much more reliable. Thanks for the feedback.

Theme © iAndrew 2016 - Forum software by © MyBB