Professional CodeIgniter

(singke) #1

Chapter 2: Agile Methodologies and Approaches


35


Although not mentioned yet, one could correctly deduce that products can be active or inactive.

Something else not mentioned, but presumably a requirement, is that every product has a price
expressed as a decimal number.

Converting what you know about categories into a query that would create a table in MySQL, you
would have something like this:


CREATE TABLE ‘categories’ (
‘id’ INT NOT NULL AUTO_INCREMENT ,
‘name’ VARCHAR( 255 ) NOT NULL ,
‘shortdesc’ VARCHAR( 255 ) NOT NULL ,
‘longdesc’ TEXT NOT NULL ,
‘status’ ENUM( ‘active’, ‘inactive’ ) NOT NULL ,
‘parentid’ INT NOT NULL ,
PRIMARY KEY ( ‘id’ )
) TYPE = MYISAM ;

Similarly, converting what you know about products into a MySQL query, you would end up with the
following:


CREATE TABLE ‘products’ (
‘id’ INT NOT NULL AUTO_INCREMENT ,
‘name’ VARCHAR( 255 ) NOT NULL ,
‘shortdesc’ VARCHAR( 255 ) NOT NULL ,
‘longdesc’ TEXT NOT NULL ,
‘thumbnail’ VARCHAR( 255 ) NOT NULL ,
‘image’ VARCHAR( 255 ) NOT NULL ,
‘sizes’ ENUM( ‘s’, ‘m’, ‘l’, ‘xl’ ) NOT NULL ,
‘colors’ ENUM( ‘red’, ‘blue’, ‘green’, ‘brown’, ‘white’, ‘black’ ) NOT NULL ,
‘grouping’ VARCHAR( 16 ) NOT NULL ,
‘status’ ENUM( ‘active’, ‘inactive’ ) NOT NULL ,
‘category_id’ INT NOT NULL ,
‘featured’ ENUM (‘true’, ‘false’) NOT NULL,
‘price’ FLOAT( 4, 2 ) NOT NULL,
PRIMARY KEY ( ‘id’ )
) TYPE = MYISAM ;

At this point, using an enum for colors and sizes is a bit iffy, as there may be any number of size
classifications (one for shoes, one for shirts, one for pants) and many different available color classes. But
for right now, this will do.


Of course, having mockups and some idea of what your MySQL tables look like is a good thing, but
before your next meeting with Claudia, you need to draw up a product backlog. The product backlog
will serve as a list of all the features you want to have in the resulting eCommerce web site.



Free download pdf