/    Sign up×
Community /Pin to ProfileBookmark

Multimatrix help

More database than anything else, but I figure I’m going to be doing this in PHP so I’ll ask here

Below is a simplified table diagram with two products. There is a one to many relationship on product_ID to product_ID in the attributes table.

[IMG]http://1-2-3-direct.com/forum_stuff/attributes.gif[/IMG]

I’m having problems coming up with a matrix that will allow me to keep individual stock of variations. For example, product 1 would have small and large variations whereas product 2 will have small green, small blue, large green, large blue variations.

We don’t know how many attributes there are so having a seperate table with product_ID, attribute_1_id, attribute_2_id, quantity would not work so hot.

Any ideas on where I can even begin conceptualizing these tables? I very briefly thought about just putting the attribute_Ids into a comma seperated value on a quantity table (product_id, attributes, quantity) so that I could select say.. small, green product 2 with “select quantiy from quantity where attributes = “4,5”… but that seems.. wrong and hackish.

Are there any elegant solutions to doing this? I couldn’t find anything on google ?

Thanks for any help you can provide.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsNov 20.2005 — Why not put in an attribute which it has (color, or size or something) and then use that to look into another table to determine the possible values for that attribute?
×

Success!

Help @DaFonz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...