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

[eluser]veledrom[/eluser]
Hi,

I cannot update Options bit in shopping cart. Only updates 'qty' but not 'selected_colour'. $colour variable is full as well.

Please help. I am new for CI though.
Thanks

Code:
public function add_to_cart($productID, $productName, $productQty, $productPrice, $availableColour)
{
   $data = array(
                 array('id'      => $productID,
                       'name'    => $productName,
                       'qty'     => $productQty,
                       'price'   => $productPrice,
                       'options' => array('available_colours' => $availableColour,
                                          'selected_colour'   => 'NA'
                                    )
                       )
        );

   $this->cart->insert($data);
}

Code:
public function update_cart($rowID, $qty, $colour)
{
   $data = array('rowid'   => $rowID,
                 'qty'       => $qty,
                 'options' => array('selected_colour' => $colour)
        );

   $this->cart->update($data);
}
#2

[eluser]toopay[/eluser]
make sure you define "where" entries you wana to update..
Code:
// Like this...
$this->db->where('id', $id)->update('mytable', $data);
// Or this...
$this->db->update('mytable', $data, "id = 4");
#3

[eluser]veledrom[/eluser]
I'm sorry but what has my post to do with db? Were you imagining something when you you read my post Smile Just joking. Your signature... says something similar to it.




Theme © iAndrew 2016 - Forum software by © MyBB