public static function onOpening(Event $event) { $product = $event->getProduct(); Yii::app()->viewed->add($product->id); }