Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Concept for "people who puchased this item..."

Quote Reply
Concept for "people who puchased this item..."
What would be the most efficient way to track this?

I'm thinking of a table:

Item - Related Item - count

This could be done per-order, but would not span orders.

To span orders, it would have to track whole order histories per person, and that gets very bearish.

If the items are alphabetized, the order of the items would be the same, such that you'd only get a field:

Item1 Item2 , not Item2 Item1

So if a person ordered three items, you'd update the fields:

Item1 Item2 count++
Item1 Item3 count++
Item2 Item3 count++

4 items would use the same idea:
Item1, Item2, Item3, Item4 are sorted in order (alphabetically, product ID, etc)

Item1 Item2 count++
Item1 Item3 count++
Item1 Item4 count++
Item2 Item3 count++
Item2 Item4 count++
Item3 Item4 count++

Is there a better way?

To get related items, you would

Select from the item count table, where Item1 or Item2 = "Item" order by count desc
That would give you the most popular "go withs"

It looks a little funny, but if you sell Spiral Widgets and Circular Gadgets, the relationship between the two, alphabetically will be

Item1_column = "Circular Gadgets"
Item2_column = "Spiral Widgets"
count = nnn

While either Circular Gadgets or Spiral Widgets can be in either the Item1 or Item2 columns, as a pair, they will only show up in this order.

I don't see a better way, but there may be.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.