Skip to content

Commit

Permalink
Add to CartController implements ViewContextInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Apr 8, 2016
1 parent d3e1ad9 commit 89e7978
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use hiqdev\yii2\cart\ShoppingCart;
use hiqdev\yii2\cart\widgets\PanelTopCart;
use Yii;
use yii\base\ViewContextInterface;
use yii\data\ArrayDataProvider;
use yii\web\NotFoundHttpException;

Expand All @@ -22,7 +23,7 @@
*
* @property ShoppingCart $cart The shopping cart instance
*/
class CartController extends \yii\web\Controller
class CartController extends \yii\web\Controller implements ViewContextInterface
{
/**
* @return ShoppingCart
Expand Down Expand Up @@ -92,4 +93,13 @@ public function actionClear()

return $this->redirect(['index']);
}

public function getViewPath()
{
if ($this->getCart()->module->viewPath) {
return Yii::getAlias($this->getCart()->module->viewPath . DIRECTORY_SEPARATOR . 'cart');
}

return parent::getViewPath();
}
}

0 comments on commit 89e7978

Please sign in to comment.