作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Account_customer');
$this->modelShowAttribute = "id";
$this->modelClassName = ShopUserAccount::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Payment systems');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopPaySystem::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Content settings');
$this->modelShowAttribute = "id";
$this->modelClassName = ShopContent::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Discount goods');
$this->modelShowAttribute = "id";
$this->modelClassName = ShopDiscount::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Order statuses');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopOrderStatus::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'List of taxes');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopTax::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Control of properties payer');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopPersonTypeProperty::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Pyramid');
$this->modelShowAttribute = "id";
$this->modelClassName = ShopAffiliateTier::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Tax rates');
$this->modelShowAttribute = "id";
$this->modelClassName = ShopTaxRate::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Surcharges');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopExtra::className();
parent::init();
}
作者:373700
项目:cms-sho
/**
* @inheritdoc
*/
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => [['class' => CreatedAtColumn::className()], 'id', ['class' => DataColumn::className(), 'attribute' => 'status_code', 'format' => 'raw', 'filter' => ArrayHelper::map(ShopOrderStatus::find()->all(), 'code', 'name'), 'value' => function (ShopOrder $order) {
return Html::label($order->status->name, null, ['style' => "background: {$order->status->color}", 'class' => "label"]) . "<br />" . Html::tag("small", \Yii::$app->formatter->asDatetime($order->status_at) . " (" . \Yii::$app->formatter->asRelativeTime($order->status_at) . ")");
}], ['class' => BooleanColumn::className(), 'attribute' => 'payed', 'format' => 'raw'], ['class' => DataColumn::className(), 'attribute' => "canceled", 'format' => "raw", 'filter' => ['Y' => \Yii::t('app', 'Yes'), 'N' => \Yii::t('app', 'No')], 'value' => function (ShopOrder $shopOrder) {
return $shopOrder->canceled == "Y" ? \Yii::t('app', 'Yes') : \Yii::t('app', 'No');
}], ['class' => DataColumn::className(), 'attribute' => "user_id", 'label' => \skeeks\cms\shop\Module::t('app', 'Buyer'), 'format' => "raw", 'value' => function (ShopOrder $shopOrder) {
return (new \skeeks\cms\shop\widgets\AdminBuyerUserWidget(['user' => $shopOrder->user]))->run();
}], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopOrder $model) {
if ($model->shopBaskets) {
$result = [];
foreach ($model->shopBaskets as $shopBasket) {
$money = \Yii::$app->money->intlFormatter()->format($shopBasket->money);
$result[] = Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank']) . <<<HTML
— {$shopBasket->quantity} {$shopBasket->measure_name}
HTML;
}
return implode('<hr style="margin: 0px;"/>', $result);
}
}], ['class' => DataColumn::className(), 'format' => 'raw', 'attribute' => 'price', 'label' => \skeeks\cms\shop\Module::t('app', 'Sum'), 'value' => function (ShopOrder $model) {
return \Yii::$app->money->intlFormatter()->format($model->money);
}], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(CmsSite::find()->active()->all(), 'id', 'name'), 'attribute' => 'site_id', 'format' => 'raw', 'visible' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Site'), 'value' => function (ShopOrder $model) {
return $model->site->name . " [{$model->site->code}]";
}]]], "view" => ['class' => AdminOneModelEditAction::className(), "name" => \Yii::t('app', "Информация"), "icon" => "glyphicon glyphicon-eye-open", "priority" => 5, "callback" => [$this, 'view']]]);
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Types of payers');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopPersonType::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Plans affiliate commissions');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopAffiliatePlan::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function init()
{
$this->name = \skeeks\cms\shop\Module::t('app', 'Delivery services');
$this->modelShowAttribute = "name";
$this->modelClassName = ShopDelivery::className();
parent::init();
}
作者:BMOTec
项目:cms-sho
public function actionInvoice()
{
$model = new Invoice();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
/** @var \robokassa\Merchant $merchant */
$merchant = Yii::$app->get('robokassa');
return $merchant->payment($model->sum, $model->id, \skeeks\cms\shop\Module::t('app', 'Refill'), null, Yii::$app->user->identity->email);
} else {
return $this->render('invoice', ['model' => $model]);
}
}
作者:BMOTec
项目:cms-sho
public function run()
{
/**
* @var $contentElement CmsContentElement
*/
$contentElement = $this->controller->model;
$model = ShopProduct::find()->where(['id' => $contentElement->id])->one();
$productPrices = [];
if (!$model) {
$model = new ShopProduct(['id' => $contentElement->id]);
} else {
if ($typePrices = ShopTypePrice::find()->where(['!=', 'def', Cms::BOOL_Y])->all()) {
foreach ($typePrices as $typePrice) {
$productPrice = ShopProductPrice::find()->where(['product_id' => $model->id, 'type_price_id' => $typePrice->id])->one();
if (!$productPrice) {
$productPrice = new ShopProductPrice(['product_id' => $model->id, 'type_price_id' => $typePrice->id]);
}
if ($post = \Yii::$app->request->post()) {
$data = ArrayHelper::getValue($post, 'prices.' . $typePrice->id);
$productPrice->load($data, "");
}
$productPrices[] = $productPrice;
}
}
}
$rr = new RequestResponse();
if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
return $rr->ajaxValidateForm($model);
}
if ($rr->isRequestPjaxPost()) {
/**
* @var $productPrice ShopProductPrice
*/
foreach ($productPrices as $productPrice) {
if ($productPrice->save()) {
} else {
\Yii::$app->getSession()->setFlash('error', \skeeks\cms\shop\Module::t('app', 'Check the correctness of the prices'));
}
}
if ($model->load(\Yii::$app->request->post()) && $model->save()) {
\Yii::$app->getSession()->setFlash('success', 'Saved');
if (\Yii::$app->request->post('submit-btn') == 'apply') {
} else {
return $this->controller->redirect($this->controller->indexUrl);
}
$model->refresh();
} else {
\Yii::$app->getSession()->setFlash('error', \skeeks\cms\shop\Module::t('app', 'Failed to save'));
}
}
$this->viewParams = ['model' => $model, 'productPrices' => $productPrices];
return parent::run();
}
作者:BMOTec
项目:cms-sho
/**
* @inheritdoc
*/
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['create' => ['visible' => false], 'update' => ['visible' => false], 'system' => ['visible' => false], 'index' => ["columns" => [['class' => CreatedAtColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Date views')], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'User'), 'value' => function (ShopViewedProduct $shopViewedProduct) {
if ($shopViewedProduct->shopFuser->user) {
return $shopViewedProduct->shopFuser->user->displayName;
}
return \skeeks\cms\shop\Module::t('app', 'Not authorized') . " [{$shopViewedProduct->shopFuser->id}]";
}], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopViewedProduct $shopViewedProduct) {
if ($shopViewedProduct->shopProduct) {
return $shopViewedProduct->shopProduct->cmsContentElement->name;
}
return null;
}]]]]);
}
作者:BMOTec
项目:cms-sho
/**
* @inheritdoc
*/
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $dataProvider) {
$query = $dataProvider->query;
/**
* @var ActiveQuery $query
*/
//$query->select(['app_company.*', 'count(`app_company_officer_user`.`id`) as countOfficer']);
$query->with('image');
$query->with('cmsTree');
$query->with('cmsContentElementTrees');
$query->with('cmsContentElementTrees.tree');
}], 'settings' => ['class' => AdminModelEditorAction::className(), 'name' => \skeeks\cms\shop\Module::t('app', 'Settings'), "icon" => "glyphicon glyphicon-cog"], "activate-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\shop\Module::t('app', 'Activate'), "eachCallback" => [$this, 'eachMultiActivate']], "inActivate-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\shop\Module::t('app', 'Deactivate'), "eachCallback" => [$this, 'eachMultiInActivate']], "change-tree-multi" => ['class' => AdminMultiDialogModelEditAction::className(), "name" => \skeeks\cms\shop\Module::t('app', 'The main section'), "viewDialog" => "@skeeks/cms/views/admin-cms-content-element/change-tree-form", "eachCallback" => [\Yii::$app->createController('/cms/admin-cms-content-element')[0], 'eachMultiChangeTree']], "change-trees-multi" => ['class' => AdminMultiDialogModelEditAction::className(), "name" => \skeeks\cms\shop\Module::t('app', 'Related topics'), "viewDialog" => "@skeeks/cms/views/admin-cms-content-element/change-trees-form", "eachCallback" => [\Yii::$app->createController('/cms/admin-cms-content-element')[0], 'eachMultiChangeTrees']]]);
}
作者:BMOTec
项目:cms-sho
/**
* @inheritdoc
*/
public function actions()
{
return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $dataProvider) {
$query = $dataProvider->query;
/**
* @var \yii\db\ActiveQuery $query
*/
//$query->select(['app_company.*', 'count(`app_company_officer_user`.`id`) as countOfficer']);
$query->groupBy([CmsUser::tableName() . '.id']);
$query->innerJoin(ShopBuyer::tableName(), '`shop_buyer`.`cms_user_id` = `cms_user`.`id`');
}, "columns" => [['class' => UserColumnData::className(), 'attribute' => 'id', 'label' => \skeeks\cms\shop\Module::t('app', 'Buyer')], 'email', 'phone', ['class' => DateTimeColumnData::className(), 'attribute' => 'created_at', 'label' => \skeeks\cms\shop\Module::t('app', 'Date of registration')], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Date of last order'), 'value' => function (CmsUser $model) {
if ($order = ShopOrder::find()->where(['user_id' => $model->id])->orderBy(['created_at' => SORT_DESC])->one()) {
return \Yii::$app->formatter->asDatetime($order->created_at);
}
return null;
}], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'The amount paid orders'), 'value' => function (CmsUser $model) {
return ShopOrder::find()->where(['user_id' => $model->id, 'payed' => Cms::BOOL_Y])->count();
}]]]]);
}
作者:BMOTec
项目:cms-sho
* @date 27.03.2015
*/
use yii\helpers\Html;
use skeeks\cms\modules\admin\widgets\form\ActiveFormUseTab as ActiveForm;
/* @var $this yii\web\View */
/* @var $model \skeeks\cms\models\WidgetConfig */
$form = ActiveForm::begin();
?>
<?php
echo $form->fieldSet(\skeeks\cms\shop\Module::t('app', 'Main'));
?>
<?php
echo $form->field($model, 'email')->textInput()->hint(\skeeks\cms\shop\Module::t('app', 'Email of sales department'));
?>
<?php
echo $form->fieldRadioListBoolean($model, 'payAfterConfirmation');
?>
<?php
echo $form->fieldSetEnd();
?>
<?php
echo $form->buttonsCreateOrUpdate($model);
ActiveForm::end();
?>