Welcome Guest, Not a member yet? Register   Sign In
Cart - 7 items and not saving to the database
#1

[eluser]Unknown[/eluser]
Hi. I have the regular problem with the Cart class, that the cookie does not allow more then ~7 items to be added to the cart. I know about configuring the session to be stored to the database, and i have configured this in my config, and i see the session stored in the database.
But the problem still occurs, and sometimes the cart doesn't even get the items i put in the cart for some odd reason. Like it radnomly just says when it wants to work or not.

Changes in config.php
Code:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';

Add to cart
Code:
public function AddToCart() {
$this->load->model( 'products_model', '', TRUE );
$this->data['product'] = $this->products_model->GetProductById( $this->input->post( 'ProductID' ) );

$product = array(
    'id' => $this->input->post( 'ProductID' ),
    'qty' => $this->input->post( 'product_amount' ),
    'price' => $this->data['product'][0]['Price'],
    'name' => $this->data['product'][0]['Name'],
    'options' => array()
);

$this->cart->insert( $product );
redirect( 'index/index' );
}

Can anybody help me with the problem? I have tried to search for the solution but can't find any, or maybe im just bad at searching.

Best regards,
Dzemal




Theme © iAndrew 2016 - Forum software by © MyBB