model() public static méthode

public static model ( null | string $className = __CLASS__ )
$className null | string
 public function actionUpdate($id)
 {
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->attributes = $_POST['SettingsForm'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     } else {
         $model->loadDataFromStore($id);
     }
     $directories = glob(Yii::getPathOfAlias('webroot.themes') . "/*", GLOB_ONLYDIR);
     $themes = array();
     foreach ($directories as $directory) {
         $themes[] = basename($directory);
     }
     $layouts = CHtml::listData(Layout::model()->findAll(), 'layout_id', 'name');
     $countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name');
     $zones = CHtml::listData(Zone::model()->findAllByAttributes(array('country_id' => $model->country)), 'zone_id', 'name');
     $languages = CHtml::listData(Language::model()->findAll(), 'language_id', 'name');
     $currencies = CHtml::listData(Currency::model()->findAll(), 'currency_id', 'title');
     $yesNoOptions = array(0 => Yii::t('settings', 'No'), 1 => Yii::t('settings', 'Yes'));
     $lengthClasses = CHtml::listData(LengthClassDescription::model()->findAll(), 'length_class_id', 'title');
     $weightClasses = CHtml::listData(WeightClassDescription::model()->findAll(), 'weight_class_id', 'title');
     $taxesOptions = array("" => Yii::t("settings", "--- None ---"), "shipping" => Yii::t("settings", "Shipping Address"), "payment" => Yii::t("settings", "Payment Address"));
     $customerGroups = CHtml::listData(CustomerGroupDescription::model()->findAll(), 'customer_group_id', 'name');
     $informations = array_merge(array(0 => Yii::t("settings", "--- None ---")), CHtml::listData(InformationDescription::model()->findAll(), 'information_id', 'title'));
     // TODO: localisation
     $orderStatuses = CHtml::listData(OrderStatus::model()->findAllByAttributes(array('language_id' => 1)), 'order_status_id', 'name');
     // TODO: localisation
     $returnStatuses = CHtml::listData(ReturnStatus::model()->findAllByAttributes(array('language_id' => 1)), 'return_status_id', 'name');
     $mailProtocols = array("mail" => Yii::t("settings", "Mail"), "smtp" => Yii::t("settings", "SMTP"));
     $this->render('update', array('model' => $model, 'themes' => $themes, 'layouts' => $layouts, 'countries' => $countries, 'zones' => $zones, 'languages' => $languages, 'currencies' => $currencies, 'yesNoOptions' => $yesNoOptions, 'lengthClasses' => $lengthClasses, 'weightClasses' => $weightClasses, 'taxesOptions' => $taxesOptions, 'customerGroups' => $customerGroups, 'informations' => $informations, 'orderStatuses' => $orderStatuses, 'returnStatuses' => $returnStatuses, 'mailProtocols' => $mailProtocols));
 }
 public function actionIndex($method)
 {
     if (isset($_POST[$method])) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'setting_group=:group';
         $criteria->params = array(':group' => $method);
         Setting::model()->deleteAll($criteria);
         foreach ($_POST[$method] as $key => $value) {
             $payment = new Setting();
             $payment->setting_group = $method;
             $payment->key = $key;
             $payment->value = $value;
             $payment->serialized = 0;
             $payment->save();
         }
         Yii::app()->user->setFlash('success', $this->accept_param[$method] . ' payment method has been saved.');
         $this->redirect(Yii::app()->createUrl('payment/index', array('method' => $method)));
     }
     $models = $this->loadModel($method);
     $form_data = array();
     foreach ($models as $model) {
         $form_data[$model->attributes['key']] = $model->attributes['value'];
     }
     $order_statuses = array();
     $order_status_models = OrderStatus::model()->findAll();
     foreach ($order_status_models as $model) {
         $order_statuses[$model->order_status_id] = $model->name;
     }
     $this->render('index', array('title' => $this->accept_param[$method], 'method' => $method, 'form' => '_form_' . $method, 'form_data' => $form_data, 'order_statuses' => $order_statuses));
 }
 /**
  * Update order
  * @param bool $new
  * @throws CHttpException
  */
 public function actionUpdate($new = false)
 {
     if (SLicenseChecker::check() === false && SLicenseChecker::isOnLocalhost() === false) {
         throw new CHttpException(404, 'В ознакомительной версии редактирование заказов недоступно.');
     }
     if ($new === true) {
         $model = new Order();
         $model->unsetAttributes();
     } else {
         $model = $this->_loadModel($_GET['id']);
     }
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = $_POST['Order'];
         if ($model->validate()) {
             $model->save();
             // Update quantities
             if (sizeof(Yii::app()->request->getPost('quantity', array()))) {
                 $model->setProductQuantities(Yii::app()->request->getPost('quantity'));
             }
             $model->updateDeliveryPrice();
             $model->updateTotalPrice();
             $this->setFlashMessage(Yii::t('OrdersModule.admin', 'Изменения успешно сохранены'));
             if (isset($_POST['REDIRECT'])) {
                 $this->smartRedirect($model);
             } else {
                 $this->redirect(array('index'));
             }
         }
     }
     $this->render('update', array('deliveryMethods' => StoreDeliveryMethod::model()->applyTranslateCriteria()->orderByName()->findAll(), 'statuses' => OrderStatus::model()->orderByPosition()->findAll(), 'model' => $model));
 }
 /**
  * @param $id
  * @return OrderStatus
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = OrderStatus::model()->findByPk($id, 'is_system != 1');
     if ($model === null) {
         throw new CHttpException(404, Yii::t('OrderModule.order', 'Page not found!'));
     }
     return $model;
 }
 public function getOrderStatus($order_status_id)
 {
     $status = OrderStatus::model()->findByPk($order_status_id);
     if (!empty($status)) {
         return $status->getName();
     }
     return null;
 }
Exemple #6
0
 /**
  * @return array
  */
 public static function labelList()
 {
     $labels = [];
     $statuses = OrderStatus::model()->findAll();
     foreach ($statuses as $status) {
         if ($status->color) {
             $labels[$status->id] = ['class' => 'label-' . $status->color];
         }
     }
     return $labels;
 }
Exemple #7
0
 public function afterUninstall()
 {
     Yii::app()->settings->clear($this->id);
     //Yii::app()->unintallComponent('cart');
     $db = Yii::app()->db;
     $tablesArray = array(Order::model()->tableName(), OrderHistory::model()->tableName(), OrderProduct::model()->tableName(), OrderStatus::model()->tableName(), OrderProductHistroy::model()->tableName(), ShopPaymentMethod::model()->tableName(), ShopPaymentMethodTranslate::model()->tableName(), ShopDeliveryMethod::model()->tableName(), ShopDeliveryMethodTranslate::model()->tableName(), ShopDeliveryPayment::model()->tableName(), ProductNotifications::model()->tableName());
     foreach ($tablesArray as $table) {
         $db->createCommand()->dropTable($table);
     }
     return parent::afterInstall();
 }
 public function actionView($id)
 {
     $order = Order::model()->findByPk($id);
     if (is_null($order)) {
         // TODO: send an error here!
         die;
     }
     // TODO: add locale
     $orderStatuses = OrderStatus::model()->findAllByAttributes(array('language_id' => 1));
     $orderStatuses = CHtml::listData($orderStatuses, 'order_status_id', 'name');
     $this->render('view', array('order' => $order, 'orderHistoryModel' => new OrderHistory(), 'orderStatuses' => $orderStatuses));
 }
Exemple #9
0
 public function beforeSave()
 {
     if ($this->position == '') {
         $max = OrderStatus::model()->orderByPositionDesc()->find();
         if ($max) {
             $this->position = (int) $max->position + 1;
         } else {
             $this->position = 0;
         }
     }
     return parent::beforeSave();
 }
 /**
  * Delete status
  * @param array $id
  */
 public function actionDelete($id = array())
 {
     if (Yii::app()->request->isPostRequest) {
         $model = OrderStatus::model()->findAllByPk($_REQUEST['id']);
         if (!empty($model)) {
             foreach ($model as $m) {
                 if ($m->countOrders() == 0 && $m->id != 1) {
                     $m->delete();
                 } else {
                     throw new CHttpException(409, Yii::t('CartModule.admin', 'ERR_DELETE_STATUS'));
                 }
             }
         }
         if (!Yii::app()->request->isAjaxRequest) {
             $this->redirect('index');
         }
     }
 }
 /**
  * Delete status
  * @param array $id
  */
 public function actionDelete($id = array())
 {
     if (Yii::app()->request->isPostRequest) {
         $model = OrderStatus::model()->findAllByPk($_REQUEST['id']);
         if (!empty($model)) {
             foreach ($model as $m) {
                 if ($m->countOrders() == 0 && $m->id != 1) {
                     $m->delete();
                 } else {
                     throw new CHttpException(409, Yii::t('OrdersModule.admin', 'Ошибка удаления статуса. Он используется заказами.'));
                 }
             }
         }
         if (!Yii::app()->request->isAjaxRequest) {
             $this->redirect('index');
         }
     }
 }
 /**
  * Update order
  * @param bool $new
  * @throws CHttpException
  */
 public function actionUpdate($new = false)
 {
     Yii::app()->clientScript->registerScriptFile($this->module->assetsUrl . '/admin/orders.update.js', CClientScript::POS_END);
     if ($new === true) {
         $model = new Order();
         $model->unsetAttributes();
     } else {
         $model = $this->_loadModel($_GET['id']);
     }
     if (!$model->isNewRecord) {
         $update = Yii::t('CartModule.admin', 'UPDATE_ORDER', array('{order_id}' => CHtml::encode($model->id)));
     }
     $this->pageName = $model->isNewRecord ? Yii::t('CartModule.admin', 'Создание заказа') : Yii::t('CartModule.admin', 'ORDER', 0);
     $this->breadcrumbs = array(Yii::t('CartModule.admin', 'ORDER', 0) => $this->createUrl('index'), $model->isNewRecord ? Yii::t('CartModule.admin', 'Создание заказа') : $update);
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = $_POST['Order'];
         if ($model->validate()) {
             $model->save();
             // Update quantities
             if (sizeof(Yii::app()->request->getPost('quantity', array()))) {
                 $model->setProductQuantities(Yii::app()->request->getPost('quantity'));
             }
             $model->updateDeliveryPrice();
             $model->updateTotalPrice();
             if ($model->isNewRecord === false) {
                 $template[] = 'delete';
             }
             // register all delivery methods to recalculate prices
             Yii::app()->clientScript->registerScript('deliveryMetohds', strtr('var deliveryMethods = {data};', array('{data}' => CJavaScript::jsonEncode($deliveryMethods))), CClientScript::POS_END);
             ///  if ($new) {
             //      $this->setFlashMessage(Yii::t('core', 'Теперь Вы можете добавить товары.'));
             //}
             $this->redirect(array('update', 'id' => $model->id));
         }
     }
     $this->render('update', array('deliveryMethods' => ShopDeliveryMethod::model()->applyTranslateCriteria()->orderByName()->findAll(), 'paymentMethods' => ShopPaymentMethod::model()->findAll(), 'statuses' => OrderStatus::model()->orderByPosition()->findAll(), 'model' => $model));
 }
 /**
  * @param $key
  * @param $id
  * @return string
  */
 public function idToText($key, $id)
 {
     $val = $id;
     if ('delivery_id' === $key) {
         $model = StoreDeliveryMethod::model()->findByPk($id);
         if ($model) {
             $val = $model->name;
         }
     } elseif ('status_id' === $key) {
         $model = OrderStatus::model()->findByPk($id);
         if ($model) {
             $val = $model->name;
         }
     }
     return $val;
 }
?>
		<?php 
echo $form->dropDownList($model, 'shipping_method', CHtml::listData(ShippingMethod::model()->findAll(), 'id', function ($data) {
    return $data->getName();
}));
?>
		<?php 
echo $form->error($model, 'shipping_method');
?>
	</div>
	<div class="row">
		<?php 
echo $form->labelEx($model, 'order_status_id');
?>
		<?php 
echo $form->dropDownList($model, 'order_status_id', CHtml::listData(OrderStatus::model()->findAll(), 'id', function ($data) {
    return $data->getName();
}));
?>
		<?php 
echo $form->error($model, 'order_status_id');
?>
	</div>
	<div class="row">
		<?php 
echo $form->labelEx($description, 'comment');
?>
		<?php 
echo $form->textArea($description, 'comment', array('rows' => 6, 'cols' => 50));
?>
		<?php 
Exemple #15
0
$this->widget('bootstrap.widgets.TbButton', ['buttonType' => 'submit', 'context' => 'primary', 'label' => $model->getIsNewRecord() ? Yii::t('CouponModule.coupon', 'Add coupon and continue') : Yii::t('CouponModule.coupon', 'Save coupon and continue')]);
?>

        <?php 
$this->widget('bootstrap.widgets.TbButton', ['buttonType' => 'submit', 'htmlOptions' => ['name' => 'submit-type', 'value' => 'index'], 'label' => $model->getIsNewRecord() ? Yii::t('CouponModule.coupon', 'Add coupon and close') : Yii::t('CouponModule.coupon', 'Save coupon and close')]);
?>

        <?php 
$this->endWidget();
?>
    </div>

    <?php 
if (!$model->getIsNewRecord()) {
    ?>
    <div class="tab-pane panel-body" id="history">

        <?php 
    Yii::app()->getModule('order');
    $order = new Order('search');
    $order->unsetAttributes();
    $this->widget('yupe\\widgets\\CustomGridView', ['id' => 'order-grid', 'type' => 'condensed', 'dataProvider' => $order->search($model->id), 'filter' => $order, 'rowCssClassExpression' => '$data->paid == Order::PAID_STATUS_PAID ? "alert-success" : ""', 'ajaxUrl' => Yii::app()->createUrl('/order/orderBackend/index'), 'actionsButtons' => false, 'bulkActions' => [false], 'columns' => [['name' => 'id', 'htmlOptions' => ['width' => '90px'], 'type' => 'raw', 'value' => 'CHtml::link(Yii::t("CouponModule.coupon", "Order #").$data->id, array("/order/orderBackend/update", "id" => $data->id))'], ['name' => 'name', 'type' => 'raw', 'value' => '$data->name . ($data->note ? "<br><div class=\\"note\\">$data->note</div>" : "")', 'htmlOptions' => ['width' => '400px']], 'total_price', ['name' => 'paid', 'value' => '$data->getPaidStatus()', 'filter' => $order->getPaidStatusList()], ['name' => 'date'], ['name' => 'status', 'type' => 'raw', 'value' => function ($data) {
        return $data->status->getTitle();
    }, 'filter' => OrderStatus::model()->getList()]]]);
    ?>
    </div>
    <?php 
}
?>
</div>
Exemple #16
0
?>
    <span class="required">*</span>
    <?php 
echo Yii::t('OrderModule.order', 'are required');
?>
</div>

<?php 
echo $form->errorSummary($model);
?>
<div class="row">
<div class="col-sm-8">
<div class="row">
    <div class="col-sm-4">
        <?php 
echo $form->dropDownListGroup($model, 'status_id', ['widgetOptions' => ['data' => OrderStatus::model()->getList()]]);
?>
    </div>
    <div class="col-sm-4">
        <?php 
echo $form->datePickerGroup($model, 'date', ['widgetOptions' => ['options' => ['format' => 'dd.mm.yyyy', 'weekStart' => 1, 'autoclose' => true], 'htmlOptions' => ['id' => 'orderDate']], 'prepend' => '<i class="fa fa-calendar"></i>']);
?>
    </div>
    <div class="col-sm-4">
        <?php 
echo $form->labelEx($model, 'user_id');
?>
        <?php 
$this->widget('bootstrap.widgets.TbSelect2', ['model' => $model, 'attribute' => 'user_id', 'data' => CHtml::listData(User::model()->active()->findAll(), 'id', 'email'), 'options' => ['placeholder' => Yii::t('OrderModule.order', 'User'), 'width' => '100%', 'allowClear' => true]]);
?>
    </div>
 public function actionIndex()
 {
     $orderStatuses = OrderStatus::model()->findAll();
     $this->render('index', array('orderStatuses' => $orderStatuses));
 }
Exemple #18
0
}
?>
<!-- second secondary menu -->
<?php 
if (Yii::app()->user->hasFlash('orderMessage')) {
    ?>
<div class="alert alert-success">
	<button type="button" class="close" data-dismiss="alert">&times;</button>
	<?php 
    echo Yii::app()->user->getFlash('orderMessage');
    ?>
</div>
<?php 
}
if (isset($orders)) {
    if (!empty($orders)) {
        $this->widget('bootstrap.widgets.TbGridView', array('id' => 'manufacturer-grid', 'type' => array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED), 'dataProvider' => $orders->search(), 'filter' => $orders, 'rowCssClassExpression' => '"items[]_{$data->id}"', 'columns' => array('id', array('name' => 'total', 'type' => 'raw', 'value' => function () {
            return UtilityHelper::formatPrice($data->total);
        }), array('name' => 'order_status_id', 'type' => 'raw', 'value' => function () {
            $status = OrderStatus::model()->findByPk($data->order_status_id);
            return !empty($status) ? $status->name : null;
        }), 'payment_code', 'invoice_no')));
    } else {
        echo "<h5>You have not placed an order with us yet.</h5>";
    }
} else {
    echo "<h3>Please <a href=" . $this->createUrl('/user/login') . ">Log in</a> to view your order history</h3>";
}
?>
</div>
</div>
Exemple #19
0
 /**
  * Check if status exists
  */
 public function validateStatus()
 {
     if ($this->status_id && OrderStatus::model()->countByAttributes(array('id' => $this->status_id)) == 0) {
         $this->addError('status_id', Yii::t('OrdersModule.core', 'Ошибка проверки статуса.'));
     }
 }
Exemple #20
0
Yii::app()->getClientScript()->registerCssFile($this->module->getAssetsUrl() . '/css/order-backend.css');
$this->breadcrumbs = [Yii::t('OrderModule.order', 'Orders') => ['/order/orderBackend/index'], Yii::t('OrderModule.order', 'Manage')];
$this->pageTitle = Yii::t('OrderModule.order', 'Orders - manage');
$this->menu = [['label' => Yii::t('OrderModule.order', 'Orders'), 'items' => [['icon' => 'fa fa-fw fa-list-alt', 'label' => Yii::t('OrderModule.order', 'Manage orders'), 'url' => ['/order/orderBackend/index']], ['icon' => 'fa fa-fw fa-plus-square', 'label' => Yii::t('OrderModule.order', 'Create order'), 'url' => ['/order/orderBackend/create']]]], ['label' => Yii::t('OrderModule.order', 'Order statuses'), 'items' => [['icon' => 'fa fa-fw fa-list-alt', 'label' => Yii::t('OrderModule.order', 'Manage statuses'), 'url' => ['/order/statusBackend/index']], ['icon' => 'fa fa-fw fa-plus-square', 'label' => Yii::t('OrderModule.order', 'Create status'), 'url' => ['/order/statusBackend/create']]]]];
?>
<div class="">
    <h1>
        <?php 
echo Yii::t('OrderModule.order', 'Orders');
?>
        <small><?php 
echo Yii::t('OrderModule.order', 'manage');
?>
</small>
    </h1>
</div>


<?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'order-grid', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'datePickers' => ['Order_date'], 'afterAjaxUpdate' => 'reinstallDatePicker', 'columns' => [['name' => 'id', 'htmlOptions' => ['width' => '90px'], 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->id, array("/order/orderBackend/update", "id" => $data->id));
}], ['name' => 'date', 'type' => 'html', 'filter' => $this->widget('booster.widgets.TbDatePicker', ['model' => $model, 'attribute' => 'date', 'options' => ['format' => 'yyyy-mm-dd'], 'htmlOptions' => ['class' => 'form-control']], true), 'value' => function ($data) {
    return CHtml::link($data->date, array("/order/orderBackend/update", "id" => $data->id));
}], ['name' => 'name', 'type' => 'raw', 'value' => function ($data) {
    return isset($data->client) ? CHtml::link($data->client->getFullName(), ['/order/clientBackend/view', 'id' => $data->user_id]) : $data->name;
}, 'htmlOptions' => ['width' => '400px']], ['name' => 'total_price', 'value' => function ($data) {
    return Yii::app()->getNumberFormatter()->formatCurrency($data->total_price, Yii::app()->getModule('store')->currency);
}], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'status_id', 'url' => $this->createUrl('/order/orderBackend/inline'), 'source' => OrderStatus::model()->getList(), 'options' => OrderStatus::model()->getLabels()], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'paid', 'url' => $this->createUrl('/order/orderBackend/inline'), 'source' => $model->getPaidStatusList(), 'options' => [Order::PAID_STATUS_NOT_PAID => ['class' => 'label-danger'], Order::PAID_STATUS_PAID => ['class' => 'label-success']]], ['name' => 'delivery_id', 'header' => Yii::t('OrderModule.order', 'Delivery'), 'filter' => CHtml::listData(Delivery::model()->findAll(), 'id', 'name'), 'value' => function (Order $data) {
    return $data->delivery->name;
}], ['class' => 'yupe\\widgets\\CustomButtonColumn']]]);
Exemple #21
0
<?php

Yii::app()->getClientScript()->registerCssFile($this->module->getAssetsUrl() . '/css/order-backend.css');
$this->breadcrumbs = [Yii::t('OrderModule.order', 'Orders') => ['/order/orderBackend/index'], Yii::t('OrderModule.order', 'Manage')];
$this->pageTitle = Yii::t('OrderModule.order', 'Orders - manage');
$this->menu = [['label' => Yii::t('OrderModule.order', 'Orders'), 'items' => [['icon' => 'fa fa-fw fa-list-alt', 'label' => Yii::t('OrderModule.order', 'Manage orders'), 'url' => ['/order/orderBackend/index']], ['icon' => 'fa fa-fw fa-plus-square', 'label' => Yii::t('OrderModule.order', 'Create order'), 'url' => ['/order/orderBackend/create']]]], ['label' => Yii::t('OrderModule.order', 'Order statuses'), 'items' => [['icon' => 'fa fa-fw fa-list-alt', 'label' => Yii::t('OrderModule.order', 'Manage statuses'), 'url' => ['/order/statusBackend/index']], ['icon' => 'fa fa-fw fa-plus-square', 'label' => Yii::t('OrderModule.order', 'Create status'), 'url' => ['/order/statusBackend/create']]]]];
?>
<div class="">
    <h1>
        <?php 
echo Yii::t('OrderModule.order', 'Orders');
?>
        <small><?php 
echo Yii::t('OrderModule.order', 'manage');
?>
</small>
    </h1>
</div>


<?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'order-grid', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'datePickers' => ['Order_date'], 'afterAjaxUpdate' => 'reinstallDatePicker', 'columns' => [['name' => 'id', 'htmlOptions' => ['width' => '90px'], 'type' => 'raw', 'value' => 'CHtml::link(Yii::t("OrderModule.order", "Order #").$data->id, array("/order/orderBackend/update", "id" => $data->id))'], ['name' => 'date', 'filter' => $this->widget('booster.widgets.TbDatePicker', ['model' => $model, 'attribute' => 'date', 'options' => ['format' => 'yyyy-mm-dd'], 'htmlOptions' => ['class' => 'form-control']], true)], ['name' => 'name', 'type' => 'raw', 'value' => '$data->name . ($data->note ? "<br><div class=\\"note\\">$data->note</div>" : "")', 'htmlOptions' => ['width' => '400px']], 'total_price', ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'status_id', 'url' => $this->createUrl('/order/orderBackend/inline'), 'source' => OrderStatus::model()->getList(), 'options' => OrderStatus::model()->getLabels()], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'paid', 'url' => $this->createUrl('/order/orderBackend/inline'), 'source' => $model->getPaidStatusList(), 'options' => [Order::PAID_STATUS_NOT_PAID => ['class' => 'label-danger'], Order::PAID_STATUS_PAID => ['class' => 'label-success']]], ['name' => 'payment_time', 'filter' => $this->widget('booster.widgets.TbDatePicker', ['model' => $model, 'attribute' => 'payment_time', 'options' => ['format' => 'yyyy-mm-dd'], 'htmlOptions' => ['class' => 'form-control']], true)], ['class' => 'yupe\\widgets\\CustomButtonColumn']]]);
	<tbody>
		<tr class="odd">
			<td><strong>Sub Total</strong></td><td>N<?php 
    echo $subtotal;
    ?>
</td>
		</tr>
		<tr class="even">
			<td><strong>VAT</strong></td><td>N<?php 
    echo $vat;
    ?>
</td>
		</tr>
		<tr class="odd">
			<td><strong>Total</strong></td><td>N<?php 
    echo $total;
    ?>
</td>
		</tr>
	</tbody>
</table>
<?php 
}
?>
<div class="clear"></div>
	<?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'payment_code', 'invoice_no', array('label' => 'Order Status', 'type' => 'raw', 'value' => OrderStatus::model()->findByPk($model->order_status_id)->getName()), array('label' => 'comment', 'type' => 'raw', 'value' => !empty($description) ? $description->comment : null), 'currency_id', 'ip', 'forwarded_ip', 'user_agent', 'date_added', 'date_modified')));
?>
	

</div>
Exemple #23
0
<?php

Yii::import('orders.components.SProductsPreviewColumn');
/**
 * Display orders list
 **/
$this->pageHeader = Yii::t('OrdersModule.admin', 'Заказы');
$this->breadcrumbs = array('Home' => $this->createUrl('/admin'), Yii::t('OrdersModule.admin', 'Заказы'));
$this->topButtons = $this->widget('admin.widgets.SAdminTopButtons', array('template' => array('create'), 'elements' => array('create' => array('link' => $this->createUrl('create'), 'title' => Yii::t('OrdersModule.admin', 'Создать заказ'), 'options' => array('icons' => array('primary' => 'ui-icon-cart'))))));
$this->widget('ext.sgridview.SGridView', array('dataProvider' => $dataProvider, 'id' => 'ordersListGrid', 'filter' => $model, 'columns' => array(array('class' => 'CCheckBoxColumn'), array('class' => 'SGridIdColumn', 'name' => 'id'), array('name' => 'user_name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->user_name), array("/orders/admin/orders/update", "id"=>$data->id))'), 'user_email', 'user_phone', array('name' => 'status_id', 'filter' => CHtml::listData(OrderStatus::model()->orderByPosition()->findAll(), 'id', 'name'), 'value' => '$data->status_name'), array('name' => 'delivery_id', 'filter' => CHtml::listData(StoreDeliveryMethod::model()->orderByPosition()->findAll(), 'id', 'name'), 'value' => '$data->delivery_name'), array('class' => 'SProductsPreviewColumn'), array('type' => 'raw', 'name' => 'full_price', 'value' => 'StoreProduct::formatPrice($data->full_price)'), 'created', array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
Exemple #24
0
echo Yii::t('info', 'You may optionally enter a comparison operator (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; or =) at the beginning of each of your search values to specify how the comparison should be done.');
?>
</p>

<?php 
echo TbHtml::linkButton(Yii::t('label', 'Advanced Search'), array('url' => '#', 'class' => 'search-button', 'color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
<div class="search-form hide">
<?php 
echo $this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'order-grid', 'type' => array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED), 'dataProvider' => $model->search(), 'filter' => $model, 'rowCssClassExpression' => '"items[]_{$data->id}"', 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => 'check', 'selectableRows' => 2), 'id', array('name' => 'payment_method', 'type' => 'raw', 'value' => function ($data) {
    $pay = PaymentMethod::model()->findByPk($data->payment_method);
    $name = !empty($pay) ? $pay->getName() : null;
    return $name;
}, 'filter' => CHtml::activeDropDownList($model, 'payment_method', TbHtml::listData(PaymentMethod::model()->findAll(), 'id', function ($data) {
    return $data->getName();
}), array('empty' => ''))), 'payment_code', 'store_name', 'firstname', 'lastname', 'email', 'telephone', array('name' => 'total', 'type' => 'raw', 'value' => 'UtilityHelper::formatPrice($data->total)'), array('name' => 'order_status_id', 'type' => 'raw', 'value' => '!empty($data->orderStatus)? TbHtml::encode($data->orderStatus->getName()) : null', 'filter' => CHtml::activeDropDownList($model, 'order_status_id', TbHtml::listData(OrderStatus::model()->findAll(), 'id', function ($data) {
    return $data->getName();
}), array('empty' => ''))), 'date_added', array('class' => 'bootstrap.widgets.TbButtonColumn', 'htmlOptions' => array('style' => 'width: 20px'), 'buttons' => array('delete' => array('label' => Yii::t('label', 'Delete'), 'options' => array("class" => "dlink", 'title' => Yii::t('label', 'Delete'))), 'update' => array('label' => Yii::t('label', 'Update'), 'options' => array("class" => "update vlink", 'title' => Yii::t('label', 'Update'))), 'view' => array('label' => Yii::t('label', 'View'), 'options' => array("class" => "view vlink", 'title' => Yii::t('label', 'View')))), 'template' => '{view} {update} {delete}')), 'afterAjaxUpdate' => 'js:reSortGrid'));
?>
<div class="hlinks hide">
<div class="uid"></div>
<div class="sortLink"><?php 
echo $this->createUrl('sort');
?>
</div>
</div>
Exemple #25
0
: <?php 
echo $ordersCount;
?>
</span>
            </h4>
        </div>

        <div id="<?php 
echo $this->getId();
?>
" class="panel-collapse collapse">
            <div class="panel-body">
                <div class="row">
                    <div class="col-sm-12">
                        <?php 
$this->widget('bootstrap.widgets.TbExtendedGridView', ['id' => 'orders-grid', 'type' => 'striped condensed', 'dataProvider' => $dataProvider, 'template' => '{items}', 'htmlOptions' => ['class' => false], 'columns' => [['name' => 'id', 'htmlOptions' => ['width' => '90px'], 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link(Yii::t('OrderModule.order', 'Order #') . $data->id, ["/order/orderBackend/update", "id" => $data->id]);
}], ['name' => 'date', 'value' => function ($data) {
    return CHtml::link(Yii::app()->getDateFormatter()->formatDateTime($data->date, 'medium'), array("/order/orderBackend/update", "id" => $data->id));
}, 'type' => 'raw'], ['name' => 'name', 'htmlOptions' => ['width' => '400px']], ['name' => 'total_price', 'value' => function ($data) {
    return Yii::app()->getNumberFormatter()->formatCurrency($data->total_price, Yii::app()->getModule('store')->currency);
}], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'status_id', 'url' => $this->controller->createUrl('/order/orderBackend/inline'), 'source' => OrderStatus::model()->getList(), 'options' => OrderStatus::model()->getLabels()], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'paid', 'url' => $this->controller->createUrl('/order/orderBackend/inline'), 'source' => Order::model()->getPaidStatusList(), 'options' => [Order::PAID_STATUS_NOT_PAID => ['class' => 'label-danger'], Order::PAID_STATUS_PAID => ['class' => 'label-success']]]]]);
?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php 
$this->endWidget();
Exemple #26
0
 public function getEditableParams()
 {
     return ['notifyEmailFrom', 'notifyEmailsTo', 'showOrder' => $this->getChoice(), 'enableCheck' => $this->getChoice(), 'defaultStatus' => CHtml::listData(OrderStatus::model()->findAll(), 'id', 'name')];
 }
Exemple #27
0
    <?php 
if (!$model->getIsNewRecord()) {
    ?>
        <div class="tab-pane panel-body" id="history">

            <?php 
    Yii::app()->getModule('order');
    $order = new Order('search');
    $order->unsetAttributes();
    $order->couponId = $model->id;
    $this->widget('yupe\\widgets\\CustomGridView', ['id' => 'order-grid', 'type' => 'condensed', 'dataProvider' => $order->search(), 'filter' => $order, 'rowCssClassExpression' => '$data->paid == Order::PAID_STATUS_PAID ? "alert-success" : ""', 'ajaxUrl' => Yii::app()->createUrl('/order/orderBackend/index'), 'actionsButtons' => false, 'bulkActions' => [false], 'columns' => [['name' => 'id', 'htmlOptions' => ['width' => '90px'], 'type' => 'raw', 'value' => function (Order $data) {
        return CHtml::link(Yii::t('CouponModule.coupon', 'Order #') . $data->id, ['/order/orderBackend/update', 'id' => $data->id]);
    }], ['name' => 'name', 'type' => 'raw', 'value' => function (Order $data) {
        $result = $data->name;
        if ($data->note) {
            $result .= CHtml::tag('br');
            $result .= CHtml::tag('small', [], $data->note);
        }
        return $result;
    }, 'htmlOptions' => ['width' => '400px']], 'total_price', ['name' => 'paid', 'value' => function (Order $data) {
        return $data->getPaidStatus();
    }, 'filter' => $order->getPaidStatusList()], ['name' => 'date'], ['name' => 'status_id', 'type' => 'raw', 'value' => function (Order $data) {
        return $data->status->getTitle();
    }, 'filter' => CHtml::listData(OrderStatus::model()->findAll(), 'id', 'name')]]]);
    ?>
        </div>
    <?php 
}
?>
</div>
Exemple #28
0
<div class="row">
    <div class="col-md-3">
        <?php 
$this->renderPartial('_nav');
?>
    </div>
    <div class="col-md-9">
        <h1><?php 
echo $this->pageName;
?>
</h1>
        <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'ordersListGrid', 'itemsCssClass' => 'table table-striped table-condensed', 'dataProvider' => $orders->search(), 'template' => '{items}', 'columns' => array(array('name' => 'user_name', 'type' => 'raw', 'value' => 'Html::link(Html::encode($data->user_name), array("/cart/default/view", "secret_key"=>$data->secret_key))'), 'user_email', 'user_phone', array('name' => 'status_id', 'filter' => Html::listData(OrderStatus::model()->orderByPosition()->findAll(), 'id', 'name'), 'value' => '$data->status_name'), array('name' => 'delivery_id', 'filter' => Html::listData(ShopDeliveryMethod::model()->orderByPosition()->findAll(), 'id', 'name'), 'value' => '$data->delivery_name'), array('type' => 'raw', 'name' => 'full_price', 'value' => 'ShopProduct::formatPrice($data->full_price)'))));
?>
    </div>
</div>
Exemple #29
0
echo Yii::t('OrderModule.order', 'are required');
?>
</div>

<?php 
echo $form->errorSummary($model);
?>
<div class="row">
    <div class="col-sm-12">
        <div class="row">
            <div class="col-sm-4">
                <?php 
echo $form->labelEx($model, 'status_id');
?>
                <?php 
$this->widget('bootstrap.widgets.TbSelect2', ['model' => $model, 'attribute' => 'status_id', 'data' => OrderStatus::model()->getList(), 'options' => ['placeholder' => Yii::t('OrderModule.order', 'Status'), 'width' => '100%']]);
?>
            </div>
            <div class="col-sm-4">
                <?php 
echo $form->datePickerGroup($model, 'date', ['widgetOptions' => ['options' => ['format' => 'dd.mm.yyyy', 'weekStart' => 1, 'autoclose' => true], 'htmlOptions' => ['id' => 'orderDate']], 'prepend' => '<i class="fa fa-calendar"></i>']);
?>
            </div>
            <div class="col-sm-4">
                <?php 
echo $form->labelEx($model, 'user_id');
?>
                <?php 
$this->widget('bootstrap.widgets.TbSelect2', ['model' => $model, 'attribute' => 'user_id', 'asDropDownList' => false, 'options' => ['minimumInputLength' => 2, 'placeholder' => Yii::t('OrderModule.order', 'Select client'), 'width' => '100%', 'allowClear' => true, 'ajax' => ['url' => Yii::app()->getController()->createUrl('/order/orderBackend/ajaxClientSearch'), 'dataType' => 'json', 'data' => 'js:function(term, page) { return {q: term }; }', 'results' => 'js:function(data) { return {results: data}; }'], 'formatResult' => 'js:productFormatResult', 'formatSelection' => 'js:productFormatSelection', 'initSelection' => $model->client ? 'js:function(element,callback){callback({name:"' . $model->client->getFullName() . '"})}' : false], 'htmlOptions' => ['id' => 'client-select']]);
?>
            </div>