CodeIgniter Forums
Cart class: Unable to update - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Cart class: Unable to update (/showthread.php?tid=62903)



Cart class: Unable to update - Maaacoooo - 09-06-2015

I am unable to update the data of my cart. Well, I can only change the qty of the cart but I need to change the discount and senior.
Here's the function of my model:

Code:
 function update_cart(){

   $rowid = $this->input->post('rowid');
   $qty = $this->input->post('qty');
   $disc = $this->input->post('discount');
   $senior = $this->input->post('senior');

  foreach ($rowid as $key => $value) {
     $data = array(
              'rowid' => $value,
              'discount'   => $disc[$key],
              'senior'   => $senior[$key],
              'qty'   => $qty[$key]
           );      
          $this->cart->update($data);


   }    

  redirect($_SERVER['HTTP_REFERER'], 'refresh');

 }