Esempio n. 1
0
 private function _cartJson($json)
 {
     if ($cartModel = yii::$app->cart) {
         $json['elementsHTML'] = \app\modules\cart\widgets\ElementsList::widget();
         $json['count'] = $cartModel->getCount();
         $json['price'] = $cartModel->getCostFormatted();
     } else {
         $json['count'] = 0;
         $json['price'] = 0;
     }
     return Json::encode($json);
 }
Esempio n. 2
0
 private function _cartJson($json)
 {
     if ($cartModel = yii::$app->cart) {
         if (!($elementsListWidgetParams = yii::$app->request->post('elementsListWidgetParams'))) {
             $elementsListWidgetParams = [];
         }
         $json['elementsHTML'] = \app\modules\cart\widgets\ElementsList::widget($elementsListWidgetParams);
         $json['count'] = $cartModel->getCount();
         $json['clear_price'] = $cartModel->getCount(false);
         $json['price'] = $cartModel->getCostFormatted();
     } else {
         $json['count'] = 0;
         $json['price'] = 0;
         $json['clear_price'] = 0;
     }
     return Json::encode($json);
 }