Skip to content

Commit

Permalink
Add topcart action for topcart widget render by action
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Feb 3, 2016
1 parent df76673 commit d5758fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace hiqdev\yii2\cart\controllers;

use hiqdev\yii2\cart\ShoppingCart;
use hiqdev\yii2\cart\widgets\PanelTopCart;
use Yii;
use yii\data\ArrayDataProvider;
use yii\web\NotFoundHttpException;
Expand Down Expand Up @@ -47,6 +48,13 @@ public function actionIndex()
]);
}

public function actionTopcart()
{
if (Yii::$app->request->isAjax) {
return $this->renderAjax('topcart');
}
}

public function actionRemove($id)
{
$this->getCart()->removeById($id);
Expand Down
1 change: 1 addition & 0 deletions src/views/cart/topcart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php print \hiqdev\yii2\cart\widgets\PanelTopCart::widget(); ?>

0 comments on commit d5758fb

Please sign in to comment.