Shopping Cart with Checkout Using CodeIgniter

This shopping cart is using CodeIgniter framework that allows you to add/update/delete a product from the cart. I am using the database in my previous post as a fixed on the existing shopping cart I found in the internet.
This code is totally different from the code at “How to Build Shopping Cart w/ Checkout in PHP”. It has a cleaner code, secured and most importantly easy to understand.
Shopping cart with checkout using CodeIgniter is part of the tutorial that I am currently working. I will explain this one by one on how I created this code in the next few days.
It's so easy to create a cart using CodeIgniter. Here's an example code:
  1. public function add()
  2. {
  3. $this->load->model('Cart_model');
  5. $insert_room = array(
  6. 'id' => $this->input->post('id'),
  7. 'name' => $this->input->post('name'),
  8. 'price' => $this->input->post('price'),
  9. 'qty' => 1
  10. );
  12. $this->cart->insert($insert_room);
  14. redirect('cart');
  15. }


Post a Comment

Don't Forget to comment

About Me

My photo

HI i am mohammed  a Embedded Software Developer ,SEO specialist,Electronic engineer   Read more