codeigniter CodeIgniter Shopping Cart Display Cart Items


You can show cart items by loop through cart or you can display single item from cart.

$cartContents = $this->cart->contents();

This will return an array of cart items so you can loop through this array using foreach loop.

 foreach ($cartContents as $items){
     echo "ID : ". $items["id"] . "<br>";
     echo "Name : ". $items["name"] . "<br>";
     echo "Quantity : ". $items["qty"] . "<br>";
     echo "Price : ". $items["price"] . "<br>";

You can format this data as table cell or some div and then show in view.