FBDSC Design
From FreeBert Wiki
Contents |
[edit] Design Philosophy
This page outlines the philosophy and motiviation for structuring the cart script as it is. The original idea for this project spawned from the popularity of the freebert.com Free PHP Shopping Cart (FPHPSC). The FPHPSC was designed to be a simple script that anyone with a php-enabled website would be able to use quickly and easily in order to sell products and offer checkout options. In the years since that was released, freebert.com has received many emails praising its user-friendly and flexiblity of style in the shopping cart. We have likewise recieved many emails asking for additional functions and features.
While the free cart was designed to 'get people started quickly' with a simple cart that is easily customized, it was soon clear that many people wanted a cart full of features, and were willing to pay. The freebert.com Deluxe PHP Shopping Cart is our response to those people.
[edit] Goals
The basic philosophy behind the cart is manifold. The primary goal is to provide a complete, easy to customize shopping cart equipped with an account & order management system. That said, our primary concerns in designing this cart were:
- Easy To Install - the goal is for the cart to be easy to install. Merely upload the cart to your server, set the local settings, run the InstallTables.php file, configure your payment options and the cart is ready to go.
- Easy To Integrate - Integration of style and layout with existing sites is also a concern. We functionalized most of the HTML creation, so that it can be customized to fit in with your site's existing styles with ease.
- Easy to Customize - The included-function structure lends itself well to customizing certain parts of the cart while keeping the rest unchanged.
- As Flexible As Possible - The Deluxe Cart script allows anyone to have a cart, customer and order management system regardless if they are a fan site selling tee-shirts to large retail stores selling thousands of items around the world. The currency symbol can be changed, and manual state / province definition allows for use of the cart anywhere in the world.
[edit] Included Functions
Following on the simplicity of style customization of the free shopping cart, the Deluxe Shopping Cart is structured in a similiar way: most of what the cart does is broken into functions, grouped together in files that needed to be included in any PHP file that wants to use them. This includes both PHP processing code, as well as HTML 'display' functions.
The script is NOT written in official Object Orientated Code - that is there are no classes or office objects. Instead there are series of functions: some connect to the database, some interact with the database, some send emails, some show the contents of the cart, etc. These are grouped into files; each file contains functions of a similar purpose.
For instance, the fucntions responsible for displaying new customer forms, for processing those forms, etc, are contained in an included file called Public_Customer_Functions.php. That file must be included in any php file that wants to use those functions.
Some of the goals of structuring the data in such a way are:
- Reuse Code - Having common, included code for each function means that for a given task we only write the code once, then include that function wherever needed. For example, by having a function that displays the contents of the cart, we can include that function where ever we need to display the contents of the cart.
- Easy To Customize - Updating or customizing a function is easy - in our example there is one function that displays the contents of the cart, and by changing that function, we change how the cart is displayed wherever that function is called.
- Easy To Understand - The concept of grouped, included fucntions is easy to understand and work with. Much of the benefits of Object Orientated Code can be realized via the inclusion of fucntions - while not requiring the use and understanding of oject orientated programming, which for basic / casual PHP scripters can be daunting.
[edit] Consolidated Settings
Having all the settings in one place allows for easy installation and initial configuration of the script package. That way admins need only update one or two settings files, rather than settings stored locally on individual pages. It also allows for multiple installations of the cart on a single domain (public cart & wholesale cart, for example).
[edit] Flexible Payment Options
One of the primary uses of a shopping cart is to present customers with payment options during checkout. The Deluxe Cart has been designed to facilite various payment options. It comes equipped with two built-in payment options: Phone Order & Money Order. Also there is a system for adding other thrid party, online transaction providers, with a fully functional custom payment option setup for PayPal, which can be used to offer PayPal as a payment method; an example is also included for integrating your own third party payment option.
[edit] Well Commented Code
The php files that make up the script package are all well commented, describing both functions and actions. All coders know that well commented code is essential to understanding and customizing code.
