CodeIgniter is an open source PHP web application framework with a lot of features. Recently, thanks to the latest update, a new feature was added to this framework, called the Cart Class. In this tutorial, we’re going to take advantage of this new class, and write a shopping cart system, with a touch of jQuery added in.
Late last year CodeIgniter v1.7.2 was released with a lot of improvements and bug fixes. This version is now compatible with PHP5.3.0, they added
is_php() to Common functions to facilitate PHP version comparisons, modified
show_error() to allow sending of HTTP server response codes, and all internal uses now send proper status codes, Form helper improved and a new class which we are about to cover in this tutorial the Shopping Cart Class.
- Backend moved to BeP(BackendPro)
- Added Event calendar in BeP
- Added Ajax Todo list system in BeP
- Admin is controlled in Bep members
- Added Menus module
- Added Customer module
- Added Order module
- Creating a folder when you create a new category
- jquery dataTables is added to the back-end table
- jquery accordion is added to the back-end
- Image/thumbnails upload bug fixed
- Updated category reassign
- Changed from Captcha to reCaptcha
- Added email ordering option
- And more
One of the most common requirements any web designer/developer will come across is likely to be that of the small business taking its first steps online; a client with an established widget-selling company now wants to move into the national market and sell their widgets to the world.
What they need to do this (apart from a great-looking, functional, usable and accessible website!) is some sort of shopping-cart system to allow their customers to add, remove and update the products they wish to buy.
This article will walk through the simple steps to achieve this, using the server-side language PHP and a MySQL database.
The shopping cart library has now been released as part of the Code Igniter stable release version 1.7.2.
The code in the controller offers simple functionality:
- View products
- View shopping cart
- Update shopping cart quantities
- Delete products from shopping cart