<td>Номер заказа</td> <td>Ссылка но товар</td> <td>Количество</td> <td>Дата</td> <td>Адрес доставки</td> <td>Статус</td> </tr> <?php foreach ($model as $data) { $url = ''; $quantity = 0; foreach (BasketOrder::model()->getProductInOrder($data->id) as $value) { $url .= '<a href="' . $value["url"] . '">' . $value["url"] . '</a></BR>'; $quantity = $quantity + (int) $value['quantity']; } echo ' <tr> <td>Заказ № ' . $data->id . '</td> <td>' . $url . '</td> <td>' . $quantity . '</td> <td>' . date('d.m.Y', strtotime($data->created_at)) . '</td> <td>' . $data->address . '</td> <td>' . BasketOrder::model()->getDownliststatus($data->status) . '</td> </tr> '; } ?> </tbody> </table>
public function loadModel($id) { $model = BasketOrder::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
) ), 'htmlOptions'=>array('style'=>'white-space: nowrap'), ), ), )); */ $this->widget('bootstrap.widgets.TbExtendedGridView', array('template' => "{items}\n{pager}", 'id' => 'product-grid', 'dataProvider' => $provider, 'filter' => $model, 'type' => 'bordered striped', 'bulkActions' => array('actionButtons' => $this->bulkRemoveButton(), 'checkBoxColumnConfig' => array('name' => 'id')), 'afterAjaxUpdate' => 'function (){ $("#BasketOrder_created_at").daterangepicker({"language":"ru"}, function(){ $(this.element).change(); }); }', 'columns' => array(array('header' => '#', 'name' => 'id', 'htmlOptions' => array('style' => 'min-width: 50px')), array('name' => 'user_id', 'type' => 'raw', 'filter' => User::getUsersArray(), 'value' => function ($data) { $model = User::model()->findByPk($data->user_id); $html = ''; if ($model) { $html = '<a href="mailto:' . $model->email . '">' . $model->email . '</a>'; if (!empty($model->first_name)) { $html .= '<BR><a href="/admin/user/list/update?id=' . $model->id . '">' . $model->last_name . ' ' . $model->first_name . ' ' . $model->middle_name . '</a>'; } } return $html; }), array('header' => 'Заказаные товары', 'type' => 'raw', 'value' => function ($data) { $html = ''; foreach (BasketOrder::model()->getProductInOrder($data->id) as $val) { $productName = Yii::app()->db->createCommand()->select('name')->from('{{' . $val['module'] . '_elements}}')->where('id=' . (int) $val['item'])->queryRow(); $html .= '<a href="/' . $val['url'] . '" target="_blank">' . $productName['name'] . '</a><BR>'; } return $html; }), array('name' => 'status', 'value' => 'BasketOrder::model()->getDownliststatus($data->status)', 'filter' => BasketOrder::model()->getStatus()), array('name' => "created_at", 'value' => 'date("d-m-Y",strtotime($data->created_at))', 'filter' => $this->widget('bootstrap.widgets.TbDateRangePicker', array('model' => $model, 'attribute' => 'created_at', 'options' => array('language' => 'ru'), 'callback' => 'js:function(){$(this.element).change();}'), true)), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update} {delete}', 'buttons' => array('update' => array('label' => 'Изменить', 'options' => array(), 'url' => function ($data) { return Yii::app()->controller->itemUrl('update', $data->id); }), 'delete' => array('label' => 'Удалить', 'options' => array())), 'htmlOptions' => array('style' => 'white-space: nowrap')))));
public function actionIndex() { $model = BasketOrder::model()->findAll('user_id = ' . $this->modelUser->id . ' ORDER BY created_at DESC'); $renderPartial = "order"; $this->render('index', array('modelUser' => $this->modelUser, 'model' => $model, 'renderPartial' => $renderPartial)); }
</table> <table class="content_table" border="0"> <thead> <tr> <th style="text-align: left;width:10px; padding-left: 15px;"> <b>Изменить данные о заказе</b> </th> </tr> </thead> <tbody> <tr> <td> <?php echo $form->DropDownListRow($model, 'status', BasketOrder::model()->getStatus(), array('class' => 'span3')); ?> <?php echo $form->textAreaRow($model, 'address', array('class' => 'span5', 'rows' => 6, 'cols' => 50)); ?> <?php echo $form->textFieldRow($model, 'phone', array('class' => 'span5', 'maxlength' => 150)); ?> <?php echo $form->textAreaRow($model, 'comments', array('class' => 'span5', 'rows' => 6, 'cols' => 50)); ?> </td> </tr> </tbody> </table>
$total = $total + $value['quantity']; } } ?> <form action="?" method="post"> <table class="content_table edit_table" width="100%" border="0"> <thead> <tr> <th style="text-align:left;" colspan="2"> Фильтр заказов </th> </tr> </thead> <tbody> <tr> <td> <?php foreach (BasketOrder::model()->getStatus() as $key => $val) { echo '<input type="checkbox" value="' . $key . '" name="Filter[status][' . $key . ']">' . $val . '<BR>'; } ?> <?php echo $this->widget('bootstrap.widgets.TbDateRangePicker', array('name' => 'Filter[period]', 'options' => array('language' => 'ru'), 'callback' => 'js:function(){$(this.element).change();}'), true); ?> </td> </tr> </tbody> </table> <input type="submit" value="Фильтровать" name="statselect"> </form> <p>Всего заказано <?php echo count($model);