Re: [PHP] People who bought this also bought (amazon style) functionality...logic problem



**** Warning, this email's a bit long ****




You have a User table and a Product table, then a
linking table that
joins users with products that they have bought.



Hey David,Curt,Richard!

Thanks for replying.

Looks like I will really have to brush up on my Sql,
been using "lazy sql" for a long time... you know, the
kind that you use over and over again
(insert,update,delete etc) so the other stuff pretty
much goes in the backroom/celler of your brain




All
this is possible in
one SQL statement, the SQL is left as an exercise to
the reader.


Cool! There goes my afternoon! :D

As this is an O(n^2) query it won't scale
particularily well, so you
should cache the results somewhere, probably in the
product table. This
could be regenerated every week or two as it doesn't
actually need to be
very current.

I usually cache my stuff in a local file and serve the
cached file if x minutes are not up... can you give me
an example of cacheing DB side?





Richard;
//**
I'm trying to work out the logic to do this... and
quite frankly have hit a brick wall.

Possibly because Amazon's algorithm does not
down-scale well...
**//

That way of looking at it makes me feel better ;)



//**
You want something like this:
....
The point being that you get the 5 things that are
MOST purchased in
other orders with this same product.

The above query may well bring your DB to its knees,
and you may need
to optimize the heck out of it.
**//
Will def look into it, I have seen this functionality
on a lot of "e-com" sites which use shared hosting so
i know its do-able, will try and when I run into
problems will post again.



//**
The problem is that unless you have the volume of
Sales that Amazon
has, there may not be enough people buying enough
stuff for this to
make sense.

It also won't group accessories or anything -- It goes
solely based on
who bought what.

This is possibly great for "e-commerce" but might not
be the ideal.
**//
Volume of sales would be *no where close*, to even
mention the site this will be used on and Amazon in
the same sentance would be a sin, and grounds to be
struck down from above.
I do have another part/block below the product that
suggests accessories.

This is for a site that sells R/C helicopters online,
i have seen two other sites that sell the same
products and from my experience this "customers
who...." feature seems to work pretty well to squeeze
in a little more (maybe 1 or two items) into the
order.I think any edge for a startup is a good
thing..no matter how small.


//**
I *much* prefer the CDBaby approach where somebody
listens to the CD
and then recommends artists they think are
complementary. :-)
**//
You dont suggest I have both?
Maybe a customer suggestions for this item 'box'?



Curt;
//**
The one thing I
would do is generate some sort of table on a scheduled
bases that
links ids of the items that were bought into a some
sort of group. and
then just use that table on the page you are showing.
**//
Can you give me a little example of this?


Thanks again guys,
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
.



Relevant Pages

  • Re: Ask for a query
    ... I want a query that let ... Customer_ID 1 bought for the first time in September 2003, ... How do I write that in SQL? ... MON CUSTID ...
    (comp.databases.oracle.server)
  • Re: Merging two sql databases
    ... is to insert data from sql I bought into sql which came ... ALTER TABLE table_name RENAME normal_database_name.table_name ... Do you mean that I supposed to install a database I bought than work on that? ...
    (alt.php)
  • Re: Merging two sql databases
    ... is to insert data from sql I bought into sql which came ... with a website's script. ... It is MySql database. ...
    (alt.php)
  • Re: ALLTRIM( ) in SQL statement
    ... It makes me laught to think about a little ... book I bought several years ago: "Teach yourself SQL in 24 hours." ... He/She has prejudices. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Microsoft Security Advisory MS 03-007 - Problems
    ... My first install on a freslhly built W2K ... patch for this security issue. ... > Do you Yahoo!? ... How a Hacker Uses SQL Injection to Steal Your SQL Data! ...
    (Focus-Microsoft)