Archive for Agosto, 2007

Product Variants and Custom Values

Jueves, Agosto 30th, 2007

The new Product Variants feature has been extended to allow custom variant values which customers can define themselves. Common use of custom variant values is accepting text to apply to the product, for example, Apple providing engravements on their iPod multimedia devices, and clothing stores that print custom text on the front and back of t-shirts.

Here is a short QuickTime movie showing how product variants are created for a t-shirt product, and extended on by providing custom variant values:

osCommerce Online Merchant Product Variants QuickTime Movie
osCommerce Online Merchant Product Variants QuickTime Movie; 3.7MB

The primary change to support custom variant values went into the shopping cart class where it referenced each product in the shopping cart via its product ID. This brought in a limitation where it was not possible for a customer to add a t-shirt with different custom text values to their shopping cart incase they wanted to order the same t-shirt multiple times with different texts.

To allow this behaviour, each product in the shopping cart is now referenced by an automatically generated, customer specific, item ID where it is possible to order multiple quantities of a product, and now possible to order a product multiple times with different custom variant values.

osCommerce Online Merchant Product Info Page
osCommerce Online Merchant Product Info Page

It is now possible to mark a product variant as the default product variant on the Administration Tool to have default values already selected on the product information page. This shows above with the “Size” pull down selection list and the “Colour” radio button choices.

As this product accepts custom values, each time it is added to the shopping cart it is treated as a separate product in the shopping cart contents. This allows the product to be added multiple times with the same variant combination values but with different custom text values.

osCommerce Online Merchant Shopping Cart Page
osCommerce Online Merchant Shopping Cart Page

This behaviour only applies to products with custom variant values where adding a normal standard product to the shopping cart multiple times would increment its quantity value.

The parsing of the product variant combinations are performed by modules assigned to the variant group, which can easily extend the behaviour of product variants to suit ones needs. This modular implementation has also introduced our first PHP 5 optimized abstract class which forces modules to follow an operation standard.

To further extend the Product Variants feature, we will also be looking at making it possible for customers to upload files when adding products to their shopping cart. This builds on the custom text possibility for t-shirts where logos and images can be attached to an order. The next set of changes will finalize the implementation for the 3.0 Alpha 5 release and be committed to /trunk/, with the file upload extension being looked into for the 3.0 Alpha 6 release.

Introducing Product Variants

Martes, Agosto 21st, 2007

The Product Attributes implementation for the 3.0 Alpha 5 release is being replaced with a new cleaner and flexible solution called Product Variants. This extends the previous Product Attributes feature by creating separate product records for each variant and assigning them to one master product.

This allows the quantity, price, model, weight, status, and other product data information to be assigned distinctively to each variant a product has. As each variant has its own product record, referencing a product with a specific variant combination is easily performed with the product ID.

This is an extreme improvement over the previous implementation where specific attribute combinations were referenced with a string value containing the product ID and the various attribute group and attribute value IDs (eg, 14{2}14{5}256).

Here is a short QuickTime movie demonstrating how Product Variants are defined on the Administration Tool and how they are handled on the Online Store:

osCommerce Online Merchant Product Variants QuickTime Movie
osCommerce Online Merchant Product Variants QuickTime Movie; 1.6MB

The Administration Tool product listing identifies products containing variants and graphically distinguishes the records to normal product records:

osCommerce Online Merchant Administration Tool Product Listing
osCommerce Online Merchant Administration Tool Product Listing

The price range for the product variants (the minimum and maximum prices) are shown in the product listing as well as the number of total quantities the master product has.

Defining variants for a product can be performed by clicking on an “Add Variant” action button and by double clicking on the variant values to add:

osCommerce Online Merchant Administration Tool Product Variants
osCommerce Online Merchant Administration Tool Product Variants

The product variant combinations are held within javascript values and are first saved (or deleted) when saving the product record.

The Online Store also distinguishes between normal products and products with variants by showing either the full product price for normal products, or the minimum price for products with variations:

osCommerce Online Merchant Product Variant Pricing
osCommerce Online Merchant Product Variant Pricing

The Product Variants feature has been freshly committed to my subversion development branch and will be merged to trunk as soon as the implementation is finalized. The interaction with product variants on the product information page is being finalized and will be showcased later this week with another blogging entry.

If you’re keeping up to date with my development branch, please take a look at the changes and provide feedback on the community forums. Thanks!