/**
  * Default action is product display. This action requires the product id to be passed.
  * If we do not receive this id, redirect back to the home page since something
  * went wrong.
  */
 public function actionView()
 {
     $id = Yii::app()->getRequest()->getQuery('id');
     if (empty($id)) {
         _xls_404();
     }
     //Load a product and display the information
     $model = $this->objProduct = Product::model()->findByPk($id);
     if (!$model || !$model->IsDisplayable) {
         _xls_404();
     }
     //If our request_url (based on description) has changed, redirect properly
     if ($model->request_url != Yii::app()->getRequest()->getQuery('name')) {
         _xls_301($model->Link);
     }
     //Set breadcrumbs
     $this->breadcrumbs = $model->Breadcrumbs;
     $this->pageImageUrl = $model->SmallImageAbsolute;
     $objWishlistAddForm = new WishlistAddForm();
     $objWishlistAddForm->id = $this->objProduct->id;
     $objWishlistAddForm->qty = 1;
     $objWishlistAddForm->lists = $objWishlistAddForm->getLists();
     $objWishlistAddForm->gift_code = Wishlist::LoadFirstCode();
     $this->setPageTitle($model->PageTitle);
     $this->pageDescription = $model->PageDescription;
     $this->canonicalUrl = $model->canonicalUrl;
     $this->returnUrl = $model->absoluteLink;
     $model->intQty = 1;
     //Raise any events first
     $objEvent = new CEventProduct(get_class($this), 'onActionProductView', $model);
     _xls_raise_events('CEventProduct', $objEvent);
     $this->widget('ext.wscartanimate.wscartanimate');
     $this->widget('ext.wsproduct.wsproduct');
     $this->render('index', array('model' => $model, 'WishlistAddForm' => $objWishlistAddForm));
 }