Shopping Cart with Checkout Using CodeIgniter

Language

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');
  4.  
  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.         );             
  11.  
  12.         $this->cart->insert($insert_room);
  13.                
  14.         redirect('cart');
  15. }

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

Is it possible to get database of this turorial or not even fields name? i am stuck without db.. thanks

thanls you very much

Hi, I wonder if you are able to mail me that db-file("shopping")that seems to be used in the database config file. Please send it to [email protected] Regards Bengt (from Sweden)

In reply to by Anonymous (not verified)

The database can be found on the other shopping cart. But I have added it again on the download link above for your convenience.

thank u very much its help more for bignner:)

how to use this in xampp and the how can i import the database?

How to connect code billing.php, cart.php, & products.php!?

$config['base_url'] = 'http://localhost/codeigniter_cart/'; $config['index_page'] = 'index.php'; what exactly do i change?

Thank you so much for all these code snippets it's really helpful and easy to understand :)

You don't have permission to access /Shopping/cart/add on this server. when i try to add to cart

Please tell me where is the database or sql file

Add new comment