By Peter Bell

E-commerce options: Product Attributes vs. Master Products

I'm rebuilding my e-commerce functionality as part of the CF7 OO rewrite of the application generator. As part of this I'm revisiting all of the patterns used to see if there are more elegant ways of creating flexible, reusable e-commerce functionality. This morning I have to rebuild my product optioning system and I though it was a good time to write a post to make a distinction between two separate but overlapping functions: product attributes and master products.

[More]

Persisting Carts

If you want to support anything more than a single page commerce form or a catalog with a "buy" button next to each product, the first thing you need to add to the catalog is a cart. I tend to use persistent carts, treating a cart as a special type of order – one that hasn't been placed yet . . .

[More]

A Simple catalog: A Minimal Data Model

So, now I've described my catalog screens, and controller let's take a quick look at a basic data model for a green field catalog . . .

[More]

Controlling the Catalog

So, I've described the screens for a basic product catalog, but what about the controller API? How do I expose those screens?

According to DHH's recent comments, I should simply expose CRU and D methods (/product/view/7 or /category/view/12). But I've already decided that four verbs don't a controller API make. So my biggest question is whether to expose my service objects and verbs or whether to add a "feature facade" . . .

[More]

A Simple Catalog - Four Flexible Screens

I often break my e-commerce applications into three core e-commerce "features"- a catalog, a cart and a checkout system. The catalog is responsible for displaying products and can be used on its own for non-commerce projects or projects with third party "buy" buttons. The cart allows a user to create a list of products – whether for purchasing, future reference, or for printing out as a "pick list" (perhaps along with a coupon) for in-store purchases, and the checkout handles everything from B2B purchase orders to Paypal, COD and credit card orders – including optional shipping, discounting and online gift certificates.

The simplest comprehensive model I've been able to come up with for a catalog is four screens: category detail, product detail, search product list and cross sell product list . . .

[More]

Real World Benefits of Iterating Business Objects over Recordset

I have been proselytizing recently about the benefits of gateways returning a single, iterating object rather than a recordset. I just came across a perfect use case in a commerce site I need to rebuild this weekend.

In this site, the calculation for product price is extremely complex and requires about 30 lines of code. Unfortunately, the client wants product search, product list and product detail pages to display the price. What to do?!

In the bad old days (pre-OO), my search, product list and product detail pages would have all called the same UDF or custom tag. Luckily I have an iterating business object for my product so I can put all of the necessary code into getPrice() and whether I load it up with a single record or a collection, I can still use the same getPrice() method to encapsulate the code to calculate the price.

I would be interested to hear how anyone who uses recordsets for lists and beans for single records would handle this (the calculation is too complex and too likely to change for me to want to put it into the database).

Of course you could put the code into the service layer, looping through the query and updating it before sending it out, but then what do you do with your bean? Do you duplicate the code in the bean and the service (yuck!) or run the bean query through the same transformation before loading it up? And if you do all of the calculations in the service layer and are guaranteeing all of your getters to be dumb, aren’t you losing one of the main benefits of using beans? Why not just return a recordset for single and multiple records?

Input appreciated!!!

BlogCFC was created by Raymond Camden. This blog is running version 5.005.