public function actionEnter() { try { $promocode = yii::$app->request->post('promocode'); if (yii::$app->request->post('clear')) { yii::$app->promocode->clear(); $persent = false; $message = 'Промокод удален!'; } else { yii::$app->promocode->enter($promocode); $persent = yii::$app->promocode->get()->promocode->discount; $message = 'Промокод применен, скидка ' . $persent . '%'; } if (yii::$app->cart) { $newCost = yii::$app->cart->costFormatted; } else { $newCost = null; } return json_encode(['code' => Html::encode($promocode), 'informer' => CartInformer::widget(), 'result' => 'success', 'newCost' => $newCost, 'message' => $message]); } catch (\Exception $e) { return json_encode(['informer' => CartInformer::widget(), 'result' => 'fail', 'message' => $e->getMessage()]); } }
?> </span></h3> </div> <div class="col-md-6 custom-service"> </div> </div> <?php echo ElementsList::widget(['columns' => '3', 'showCountArrows' => false, 'type' => ElementsList::TYPE_FULL]); ?> <div class="row"> <div class="col-md-7"> <div class="total"> <?php echo CartInformer::widget(['htmlTag' => 'span', 'text' => '{c} на {p}']); ?> </div> </div> <div class="col-md-5"> <?php if (yii::$app->has('promocode')) { ?> <div class="promocode"> <?php echo \pistol88\promocode\widgets\Enter::widget(); ?> </div> <?php } ?>
echo $element->getModel()->getCartName(); ?> (<?php echo $element->getModel()->getCartPrice(); ?> р.)</strong> <?php echo ChangeOptions::widget(['model' => $element, 'type' => 'radio']); ?> </div> <div class="col-lg-4 col-xs-4"> <?php echo ChangeCount::widget(['model' => $element]); ?> </div> <div class="col-lg-2 col-xs-2"> <?php echo DeleteButton::widget(['model' => $element, 'lineSelector' => '.row']); ?> </div> </div> <?php } ?> <div class="total"> <?php echo CartInformer::widget(['htmlTag' => 'h3']); ?> </div> </div>
public function actionCartInfo() { die(json_encode(['cart' => ElementsList::widget(['columns' => '3', 'showCountArrows' => false, 'type' => ElementsList::TYPE_FULL]), 'total' => CartInformer::widget(['htmlTag' => 'div', 'text' => '{c} на {p}']), 'count' => yii::$app->cart->count])); }
public function actionCartInfo() { die(json_encode(['cart' => ElementsList::widget(['type' => ElementsList::TYPE_FULL, 'showOffer' => false, 'otherFields' => $this->module->cartCustomFields]), 'total' => CartInformer::widget(['htmlTag' => 'div', 'text' => '{c} на {p}']), 'count' => yii::$app->cart->count])); }