Open Source Services
taming open source systems...
Home
Friday, 05 December 2008
Main Menu
Home
Forum
Products
Download
Sitemap
Contact Us
Login Form





Lost Password?
No account yet? Register
Handling Product Attributes Print E-mail
 

By Administrator, on 04-08-2008 10:40

Views : 127    

Favoured : 12

Published in : Technical Comparison of Popular Open Source Shopping Carts, Databases


This section summarizes the relationships between products, options and option values and then presents how data relating to product attributes is stored in the database.

The 'Product Attributes' sections of CRELoaded and osCommerce are more or less the same and we will begin by looking at them.

When setting up a product attribute in the 'Product Attributes' section for any given product, you must do the following:

 

1) Set up a product option (e.g. Color).

2) Set up option values for that option (e.g. Red, Green, Blue).

3) Attach the option (and any of its option values) to the product and set a price differential for each option value.

 

The relationships between the three elements of Product Attributes are as follows:

(Product : Product Option) = (1 : many)

(Product Option : Option Value) = (1 : many)

 

CRELoaded Database

In order to recreate the above relationships in the database, CRELoaded uses 5 tables. They are:

products_attributes
products_options
products_options_text
products_options_values
products_options_values_to_products_options

 

We can now see which tables are accessed during each stage of product attribute setup:

 

1) Set up a product option (e.g. Color).

Initial information about product options is stored in two of the tables. First, the product option is given its all-important 'products_options_id' value in the 'products_options' table which the system will use to identify it throughout its life. Secondly, the name of the product option is stored in the 'products_options_text' table. Notice that the 'products_options_id' value in the 'products_options' table and the 'products_options_text_id' value in the  'products_options_text'  table must be identical for the 'products_options_id' and the 'products_options_name' to correlate.

 

 2) Set up option values for that option (e.g. Red, Green, Blue).

 During this phase, an option value is added to a selected product option. First of all, the 'products_options_values_id' is assigned to the option value and is persisted together with the supplied 'products_options_values_name' in the 'products_options_values' table. Notice that the id and name of the option value are stored in one table whereas the id and name of product options are stored in two. The 'products_options_values' table contains no references to product options. The linkage between a product option and an option value is established during this phase by attaching the selected 'products_options_id' to the 'products_options_values_id' in the 'products_options_values_to_products_options' table.

 At this stage, we have established an option value as being linked to a product option. Of course the user can still choose whether or not the option value will be made available to a customer in the store front, and that selection is part of the final phase.

 

3) Attach the option (and any of its option values) to the product and set a price differential for each option value.

 In this final phase, the user does most of the work in selecting a product, then a product option and a related option value before setting a price differential for this particular set of entities. Behind the scenes, only one table - 'products_attributes' - is accessed because it holds all the required fields for identifying each of the related entities(product, product option and option value id's). The table also holds the price prefix and the amount of the price differential itself.

 

When coding for Product Attributes, it is usually useful to be able to get the name if the entity from its id number or vice versa. To do this, use the following tables:

 

Product Options (id <-> name): Use table 'products_options_text', remembering that the 'products_options_text_id' value is also the 'products_options_id'

Option Values (id <-> name): Use table 'products_options_values'


Last update : 04-08-2008 11:32

   
Quote this article in website
Favoured
Send to friend
Related articles

Users' Comments  RSS feed comment
 

Average user rating

   (0 vote)

 


Add your comment
Name
E-mail
Title  
 
Comment
 
Available characters: 600
   Notify me of follow-up comments
  This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter the word below (refresh the image if it is difficult to see):

   
   

No comment posted



mXcomment 1.0.8 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved
 
© 2008 Open Source Services
Designed by Open Source Services. Powered by open source software.
Seasonale
Generated in 2.47243 Seconds