I know exactly what you mean. I've spend a lot of time searching for documentation as the sourcecode (let alone others' contribs) are not commented. I'm by no means a hard core developer and only dived right into this because I had no choice. I would start a wiki for developers but v3 is around the corner so I guess v2.2 will be phased out soon.
I can only help you with your first question: how are attributes stored. In a post on the mysql forum I've made an illustration of how the products and attributes relate to each other and has helped me greatly to understand how the database is set up.
the header is the table name with the columns as subheaders:

I've highlighted with colors which ID's match in each table. You can see that the products table has a matching products_id in products_attributes. Each product can have multiple attributes assigned, stored in each row of the products_attributes table. So there can be more than one products_id in the attrib table. please see myphpadmin (if your host supports this tool) and look in the database.
The designers made a mistake in naming ID's as in the products_attributes table there's a options_id and options_values_id, which matches with the differently named products_options_id and products_options_values_id. I didn't know that at the time I made the illustration.
The products_options_id describe the group name of an attribute (like color) and products_options_values_id describes the kind of attribute, like blue, red or orange. ID's are of course numbers only, each table (products_options and products_options) also contains a name field which has a string.
When an attribute is assigned/added to a product, a new row is added to the products_attributes table, when an attribute is removed, the row is removed also. There's no enabled/disabled toggle as one would expect, although this is much more efficient space wise, it can be difficult to check which are present and which aren't.
I haven't touched the shopping cart yet, I can't comment on that but it would be best to print out the class (or use multiple monitors to lay source code side by side and go through it all, adding comments when certain parts are understood.
I hope version 3 will be better commented and documented. At least its more object oriented now so it should be easier to understand and extend.
Good luck!
QUOTE (aspiringdeveloper @ Apr 18 2008, 06:11 PM)

I hate to double post but in the installation & configuration forum I am not getting much help. this topic
http://forums.oscommerce.com/index.php?showtopic=298652 is more of a core development issue. If a seaoned php developer can please read the thread (only 8 posts) it would really help me out.
Basically my proposed mod adds a few new tables. : grid_attibutes, grid_row_col.
Some products will have grid atributes which basically mean an an entry in the grid_attibutes table for each row/col cell in the table. The table will have prices shown.
To illustrate: I sell pet food in various flavours and various bag sizes. Its foolish to set up an individual attribute for each flavour-size combination. * although I could do that and it would work fine *. I rather have all my food displayed in a table for a particular brand (where brand represents 1 entry in the products table).
Long sotry short: Adding new tables gets to the core of the product. I may have to make many logic branches in the shopping_cart class, the product_info.php file etc etc.
I need to understand in some kind of flow chart high level way the mechanisms behind product attributes and how product attributes gets assigned to the shopping_cart class. Basically, I am starting very slowly to understand some of the mechanisms by reverse engineering. But this is a slow and error prone way to about it.
There must be in the hands of some developers some form of planning chart or diagram showing how each piece of the puzzle fits together. I've gone through the enclosed 114 page documentation, which has some noce suggestions of customizations but only on a superficial level. I really need to get into the meat and bones of oscommerce and for that I need to understand more about how the oscommerce logic is put together.
In particular: what are the mechanisms of a user adding an attribute--> getiing that attribute assigned to the class--> Basket table updated--> convert to order etc. I'll need to mirror the same logic for my grig_attibutes.
Thanks in advance. I hope someone can help me to help improve oscommerce.