示例#1
0
 public static function PopulateOrderViewModel($order)
 {
     $model = new OrderViewModel();
     $model->id = $order->order_id;
     $model->account_id = $order->account_id;
     $model->branch = BranchService::GetById($order->branch_id)->name;
     $model->date_order = $order->date_order->format('Y-m-d H:i:s');
     $model->status_id = Statusorder::find(['statusorder_id' => $order->statusorder_id])->name;
     return $model;
 }
 function action_ConfirmOrder()
 {
     session_start();
     $model = $_SESSION['basket'];
     if (!is_null($_SESSION["login"])) {
         $address = $_GET['a'];
         $model->branch = BranchService::GetByAddress($address);
         $_SESSION['basket'] = $model;
         $this->view->generate('ConfirmOrder_view.php', 'template_view.php', $model);
     } else {
         header('Location: /Account/login');
     }
 }
 public function executeGetmarketingoptions($request)
 {
     $branch_id = 0;
     $this->marketing_options = sfConfig::get('mod_client_marketing_options');
     $branch_id = $request->getParameter('branch_id');
     if ($branch_id) {
         $branch_id = $request->getParameter('branch_id');
         $branch_service = new BranchService($branch_id, $this->sf_user_id);
         $this->marketing_options = $branch_service->getMarketingOptionList();
         //            $this->marketing_options = array(1=>'a', 2=>'b', 3=>'c',4=>'d', 5=>'e', 6=>'f', 7=>'g');
     }
     $this->getResponse()->setHttpHeader('Content-type', 'application/json');
     return $this->renderText(json_encode($this->marketing_options));
 }
    <tr>
        <td colspan="5" class="text-right">
            <form class="form-horizontal">
                <div class="form-group">
                    <p class="col-sm-2"></p>

                    <p class="col-sm-10 text-left" id="error" style="color: red"></p>
                </div>
                <div class="form-group">
                    <label for="inputAddress" class="col-sm-2 control-label">Выберите место получения заказа</label>

                    <div class="col-sm-10">

                        <select class="form-control" id="inputAddress">
                            <?php 
$branchs = BranchHelper::PopulateBranchViewModelList(BranchService::GetAll());
for ($i = 0; $i < count($branchs); $i++) {
    ?>
                                <option><?php 
    echo $branchs[$i]->address;
    ?>
</option>
                                <?php 
}
?>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" onclick="ConfirmOrder(this)" class="btn btn-default">Продолжить</button>