Question

Here is my dilemma, I am building a POS system for a pretty large retailer, they have different products which have different attributes (size, color, etc...).

When they receive the merchandise from the supplier they want to do their own labeling with their own UPC Bar Codes but they also want to differentiate between the different sizes using the code on the article.

Say they received Brand A shirts with 4 sizes S,M,L,XL then they should have different bar codes for each size.

So I thought of having a base code for the article and then concatenating numbers depending on the attributes to have different codes? and if no attributes are available just add 0s

I am storing the sizes and colors as attributes in the database as an (Entity-Attribute-Value). Is their a better way other than having to start concatenating numbers from the attributes to come up with the full code?

Thanks for your help!

edit-------------------------------------------------------

I am making the example a bit clearer so the base code for the shirts is: 9 123456 Then for Color blue is: 789 and then for size S: 012 so the full code is 9 123456 789012

for another article that doesn't have size or color or actually any attribute the base code would be 9 654321 plus 000000 for the attributes part

this is just for simplicity sake as I can use only one digit per attribute.

The other issue is when linking to the OrderDetails table I need to reference all the attributes to know that the customer actually bought Size S in Blue

Was it helpful?

Solution

One possible option is to create a table that stores the bar code as the key. Then have an attribute for the size and the color.

OTHER TIPS

Actually @jzd your answer is pretty close but I would like to keep the attributes as key value pair.

The idea is to use and an attribute set and have a bar code associated with each set. here is a rough schema

AttributeSet Table:
 AttributeSetId
 ProductId
 AttributeSetName
 BarCode


AttributeUse Table:
 AttributeSetId
 AttributeId

AttributeSetInstance Table: 
 AttributeSetId
 AttributeId
 AttributeValueId

if you forget the barcode for a minute...

do you have a database to track this inventory?

are the items stored discretely in this database?

if so, then just add a unique number to the item, called the UPC vale - i recommend not trying to make an intelligent key s\as you are describing

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top