add customer cart

This commit is contained in:
2015-10-21 17:57:16 +02:00
parent baf7c79d04
commit 23a0390a27
14 changed files with 467 additions and 16 deletions

View File

@@ -20,6 +20,7 @@ use common\models\Discount;
use common\models\Transfer;
use common\models\User;
use common\models\UserSoldItem;
use common\models\ShoppingCart;
/**
* ProductController implements the CRUD actions for Product model.
@@ -71,6 +72,8 @@ class ProductController extends Controller
$user = User::findOne(Yii::$app->user->id );
$model->customer = $this->customer;
if (Yii::$app->request->isAjax) {
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
@@ -103,6 +106,7 @@ class ProductController extends Controller
// $userTransfers = Transfer::readUserSoldTransfers( $user );
$userTransfers = Transfer::modelsToArray( Transfer::readUserSoldTransfers($user) );
$model->customerCart = ShoppingCart::readCustomerCart( $this->customer );
return $this->render("sale",[
'customer' => $this->customer,
@@ -112,7 +116,7 @@ class ProductController extends Controller
'currencies' => $currencies,
'accounts' => $accounts,
'discounts' => $discounts,
'userTransfers' => $userTransfers
'userTransfers' => $userTransfers,
]);
}