People who bought this... but with articles

Author Message

Jorge estévez

Tuesday 05 October 2004 9:37:02 pm

Hi!

People who bought this also bought... Can I do something similar with articles? I would like to implement something like: People who saw this article also saw:

1-xx
2.-yy
and so on...

Ho can an object relation be implemented in this manner, knowing the relation on people who saw the same article the user is in and the related articles that they also visited... (rather confusing, hope you get the idea)

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gunnstein Lye

Monday 11 October 2004 4:37:18 am

This must be implemented on a low level, probably in index.php, because articles are usually cached. You could make an SQL table with two columns, user id and object id, and whenever someone views an object you can detect this in index.php and store the information in the table. When you need the information, run some queries like this:

X is the object id of the object in question.
First, fetch all users who has viewed this object:

select user_id from user_object_read_table where object_id = X;

For each user, fetch his object ids:

select object_id from user_object_read_table where user_id = 42;

Then you have a list of all objects this users has viewed. Do this for all the users, concatenate the results, and return the object ids that are most common.
This will be somewhat slow on a medium to large site, so you might want to do it in a daily cronjob.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 00:36:47
Script start
Timing: Jan 19 2025 00:36:47
Module start 'layout'
Timing: Jan 19 2025 00:36:47
Module start 'content'
Timing: Jan 19 2025 00:36:48
Module end 'content'
Timing: Jan 19 2025 00:36:48
Script end

Main resources:

Total runtime1.1655 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.0391152.6406
Module start 'layout' 0.00550.0041 740.679739.4609
Module start 'content' 0.00961.1544 780.1406526.5156
Module end 'content' 1.16400.0015 1,306.65638.1406
Script end 1.1654  1,314.7969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2612160.0002
Check MTime0.00130.1140160.0001
Mysql Total
Database connection0.00080.065510.0008
Mysqli_queries1.120296.1149540.0207
Looping result0.00050.0450520.0000
Template Total1.131397.120.5656
Template load0.00200.172620.0010
Template processing1.129296.890420.5646
Template load and register function0.00010.007910.0001
states
state_id_array0.00110.090610.0011
state_identifier_array0.00090.076620.0004
Override
Cache load0.00170.1426200.0001
Sytem overhead
Fetch class attribute can translate value0.00060.049120.0003
Fetch class attribute name0.00110.094630.0004
XML
Image XML parsing0.00070.058620.0003
class_abstraction
Instantiating content class attribute0.00000.000530.0000
General
dbfile0.00110.0932160.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs