public function actionView($name, $category = null)
{
$product = $this->productRepository->getBySlug($name);
if (null === $product || isset($product->category) && $product->category->path !== $category || !isset($product->category) && !is_null($category)) {
throw new CHttpException(404, Yii::t('StoreModule.catalog', 'Product was not found!'));
}
Yii::app()->eventManager->fire(StoreEvents::PRODUCT_OPEN, new ProductOpenEvent($product));
$this->render('view', ['product' => $product]);
}