CodeIgniter Forums
Need a little help with the Cart class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Need a little help with the Cart class (/showthread.php?tid=25236)



Need a little help with the Cart class - El Forum - 12-05-2009

[eluser]bdegier[/eluser]
Hello,

I'm spending my saturday finishing a simple shoppingcart i started building a while ago. I'm now trying to write some sort of an update cart function.

- Before I continue: I'm not so experienced in the PHP field Smile -

I want users to be able to change the value of the quantity text fields, then press a button and the cart updates the quantity of all products currently in the cart.

The User Guide has a short explanation about this: http://ellislab.com/codeigniter/user-guide/libraries/cart.html

But i can't quite figure out how to get the rowID's for the products and use this to update the cart.

I wrote a very basic function to test the updating which works (hardcoded):
Code:
function updateCart() {
        $data = array(
               array(
                       'rowid'   => 'b99ccdf16028f015540f341130b6d8ec',
                       'qty'     => 3
                    ),
               array(
                       'rowid'   => 'xw82g9q3r495893iajdh473990rikw23',
                       'qty'     => 4
                    ),
               array(
                       'rowid'   => 'fh4kdkkkaoe30njgoe92rkdkkobec333',
                       'qty'     => 2
                    )
      );

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

All help will be GREATLY appreciated!

Thanks,

Bento


Need a little help with the Cart class - El Forum - 12-05-2009

[eluser]bdegier[/eluser]
Got PMed this tutorial which somehow i was unable to Google Smile
http://nuazul.net/php/shopping-cart-using-codeigniter-1-7-2-cart-library-part-2.html

Cheers.