[eluser]CI Freak[/eluser]
Thank you for your help d1a8lo24 and darrentaytay.
I already have the DB structure in place, something like this.
Product table (id field: `pid`)
option groups (linked via pid field in option groups and product table)
option values (linked via groupid in values and groups table).
Product <- option group(size) <- value1(small), value2(medium), value3(large)
<- option group(colour) <- value1(red), value2(green), value3(blue)
The reason I am running out of memory and getting timeouts is because one part of the application requires that you output all stock information on one screen, so a form is generated with input boxes for each and every possible combination of options.
the stock table is laid out something like this
selector | stockval | unlimited | code
570X112-443-132 | 15 | 0 | ABC123
the above record translates to the following:
Product ID 570
options:
SIZE: Medium (value id 112);
COLOUR: Red (value id 443);
MATERIAL: Cloth (value id 132);
The customer has 15 Medium, Red cloth shirts in stock, and this unique products id is ABC123.
The customer can add as many option `groups` as they like (size, colour, material etc..) and as many `options` as they like (small, medium, large OR x-small small medium large x-large xx-large).
before the customer add's the product to their cart, the system checks all of the options they have selected, arranges them in ascending order and look's up the stock from the table, if the product is out of stock then the user gets shown a message and the product will not be added to the cart.
it just seems like a really cumbersome/heavy way to achieve this, not to mention the more options you add, the bigger the db and the longer the load time in certain areas of the system. Keep in mind alot of people who use this system have products with like 6 or 7 option groups, each with at least 15 values in some cases, and the system needs to be able to have stock for any, and every given possible combination of those options...