Welcome Guest, Not a member yet? Register   Sign In
Cannot update shopping cart
#1

[eluser]Sezgin[/eluser]
Hi All!

I need your help, I am new codeigniter programmer and I have problems with updating my cart.

The method that I use for update is this:

function updateCart( )
{
$rowid = $this->input->post('rowid');
$qty = $this->input->post('qty');

$data = array(
'rowid' => $rowid,
'qty' => $qty
);

$this->cart->update( $data );
redirect( 'cart/' );
}

//-----------------------------------------------
And here is the view part that is used from the updateCart:

echo form_hidden( 'qty' , $item['qty'] );
$data = array(
'name' => 'qty',
'value' => $item['qty'],
'maxlength' => '2',
'size' => '1'
);
echo form_input( $data );

echo form_hidden( 'rowid' , $item['rowid'] );
echo form_submit( 'rowid' , 'Update your Cart' );

//------------------------------------------------------------

I consider that the problem is above. I appriciate your help. Thank you.
#2

[eluser]Seb[/eluser]
In your controller, replace

Code:
$this->cart->update( $data );
with
Code:
$this->cart->update( 'your_table', $data );
#3

[eluser]Sezgin[/eluser]
Well, I don't use any tables, everything must be saved in session variable( cart ).
#4

[eluser]Seb[/eluser]
Oh sorry, I was totally wrong and misread your first post.

But reading it again, why do you have the

Code:
echo form_hidden( ‘qty’ , $item[‘qty’] );

at the beginning?

I guess it is conflicting with the next form_input statement.
#5

[eluser]Sezgin[/eluser]
It works! I found out my mistake. Smile Thank you Seb, I appreciate your help.




Theme © iAndrew 2016 - Forum software by © MyBB