RE: [PHP-DB] Similar Articles or Customers also bought...

From: Date: Mon, 21 Jan 2002 23:34:29 +0000
Subject: RE: [PHP-DB] Similar Articles or Customers also bought...
Groups: php.db 
Request: Send a blank email to php-db+get-16041@lists.php.net to get a copy of this message
Technically, you should have a list of saved orders associated with a customer ID. You should be able to search the saved orders for all customer IDs that purchased the current product ID. Then, generate a giant list of all products that all those customer IDs purchased, and compile them into a big list, with the most common purchases at the top. You should then maybe have an array looking like: $Products["Product Name"] = Number Purchased; --------------------------------------------- $Products["PHP Programming Book"] = 24; $Products["MySQL Programming Book"] = 22; $Products["PC Magazine Subscription"] = 14; $Products["Windows XP Pro"] = 6; $Products["Anti-Fungal Loin Cream"] = 1; --------------------------------------------- Then, display any products that have more than X number of purchases. That way, you truly have a valid "Customers That Bought This Also Bought These" list. A bit intensive, maybe, but it works. - Jonathan -----Original Message----- From: olinux [mailto:olnx@yahoo.com] Sent: Monday, January 21, 2002 3:25 PM To: php-db@lists.php.net Subject: [PHP-DB] Similar Articles or Customers also bought... I am trying to figure a simple way of creating a script for a news site to recommend articles that are similar [i.e. about the same company] Two examples are: http://www.theroyalgazette.com/apps/pbcs.dll/artikkel?Avis=RG&Dato=20011218& Kategori=BUSINESS&Lopenr=112180020&Ref=AR (See the "Linked Articles") and Amazon's "Customers who bought this book also bought:" feature I think it would work something like this TABLE 1 keyword_id | keywords TABLE 2 url_id | url | url_title TABLE 3 id | keyword_id | url_id this would be your basic search engine - for example you could look up a keyword in table 1 using that keyword_id get the url_id's that correspond and then get the url's and titles for display. I guess that the "similar srticles" feature would work the same way by taking the current url_id lookup the corresponding keyword_id's use those to query for url_id's that match those keywords and then grab the url and title for display. Confused? I am :) This seems like it would work, but seems too intensive... Maybe a different table structure which contains url_id | similar_url would be better? then you could look up the current url_id for url_id's of similar articles? Thanks for your help. olinux __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#16041) next »