Recently viewed and Similar items

How to implement recently viewed or "Just viewed" functionality? and Also Similar items pr Similar products functionality in Yii? Do we have an example please?

recently viewed is implemented usually with user session - you add product id upon view (if it is not already stored in session). you keep up to x such id’s and use them to display recently viewed: $criteria->addInCondition( ‘’, Yii::app()->session[‘recently_viewed’] );

similar products may be implemented in many ways. simplest is just many_many relation to other products which must be entered by some administrator (for every product you connect it with "similar products").

but those lists may be build otherways: by linking products bought on same order, weigheted with number of orders having such related products; using FTS features "more like this" (Solr has such feature, it works based on some product attributes comparison); there can be many more options… but it is preferred not to calculate them online but rather stick with many_many relation but instead of administrator - fill it with automatic task runned on regular time basis.

Great! Let me try then… if you have more resource please it would be much helpful.