public function actionIndex() { $model = new Order(); $request = Yii::$app->request; if ($model->load($request->post())) { $returnUrl = Shopcart::send($model->attributes) ? $request->post('successUrl') : $request->post('errorUrl'); return $this->redirect($returnUrl); } else { return $this->redirect(Yii::$app->request->baseUrl); } }
public function actionDelete($id) { if ($model = Order::findOne($id)) { $model->delete(); } else { $this->error = Yii::t('easyii', 'Not found'); } return $this->formatResponse(Yii::t('easyii/shopcart', 'Order deleted')); }
public function dbInstall() { $db = Yii::$app->db; $tableOptions = null; if ($db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=MyISAM'; } $db->createCommand()->createTable(Order::tableName(), ['order_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'address' => Schema::TYPE_STRING . '(255) NOT NULL', 'phone' => Schema::TYPE_STRING . '(64) NOT NULL', 'email' => Schema::TYPE_STRING . '(128) NOT NULL', 'comment' => Schema::TYPE_STRING . '(1024) NOT NULL', 'remark' => Schema::TYPE_STRING . '(1024) NOT NULL', 'access_token' => Schema::TYPE_STRING . '(32) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'new' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $tableOptions)->execute(); $db->createCommand()->createTable(shopcart\models\Good::tableName(), ['good_id' => 'pk', 'order_id' => Schema::TYPE_INTEGER, 'item_id' => Schema::TYPE_INTEGER, 'count' => Schema::TYPE_INTEGER, 'options' => Schema::TYPE_STRING . '(255) NOT NULL', 'price' => Schema::TYPE_FLOAT . " DEFAULT '0'", 'discount' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $tableOptions)->execute(); }
public function getOrder() { return $this->hasOne(Order::className(), ['order_id' => 'order_id']); }
echo $page->title; ?> </h2> <div class="sub-title col-md-12"> <p style="text-align: center;"><?php echo $page->text; ?> </p> </div> <div class="clearfix"></div> <div class="row"> <?php if (Yii::$app->session->getFlash('order_id')) { $sql = 'SELECT country FROM easyii_shopcart_orders where order_id=' . Yii::$app->session->getFlash('order_id'); $order = Order::findBySql($sql)->one(); if ($order->country != 'EGY') { ?> <div class="panel panel-default"> <div class="panel-heading"><?php echo $pay->title; ?> </div> <div class="panel-body"> <?php echo $pay->text; ?> </div> </div> <?php }
<?php use yii\easyii\modules\shopcart\models\Order; use yii\helpers\Html; use yii\helpers\Url; $this->title = Yii::t('easyii/shopcart', 'Order') . ' #' . $order->primaryKey; $this->registerCss('.shopcart-view dt{margin-bottom: 10px;}'); $states = Order::states(); unset($states[Order::STATUS_BLANK]); $module = $this->context->module->id; $this->registerJs(' var oldStatus = ' . $order->status . '; $("#order-status").change(function(){ if($(this).val() != oldStatus){ $("#notify-user").slideDown(); } else { $("#notify-user").slideUp(); } }); '); echo $this->render('_menu'); ?> <?php echo Html::beginForm(); ?> <dl class="dl-horizontal shopcart-view"> <?php if ($order->status != Order::STATUS_BLANK) { ?> <dt><?php
public function up() { //ADMINS $this->createTable(models\Admin::tableName(), ['admin_id' => 'pk', 'username' => Schema::TYPE_STRING . '(32) NOT NULL', 'password' => Schema::TYPE_STRING . '(64) NOT NULL', 'auth_key' => Schema::TYPE_STRING . '(128) NOT NULL', 'access_token' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine); //$this->createIndex('access_token', models\Admin::tableName(), 'access_token', true); //LOGINFORM $this->createTable(models\LoginForm::tableName(), ['log_id' => 'pk', 'username' => Schema::TYPE_STRING . '(128) NOT NULL', 'password' => Schema::TYPE_STRING . '(128) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'user_agent' => Schema::TYPE_STRING . '(1024) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'success' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine); //MODULES $this->createTable(models\Module::tableName(), ['module_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'class' => Schema::TYPE_STRING . '(128) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'icon' => Schema::TYPE_STRING . '(32) NOT NULL', 'settings' => Schema::TYPE_TEXT . ' NOT NULL', 'notice' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine); //$this->createIndex('name', models\Module::tableName(), 'name', true); //PHOTOS $this->createTable(models\Photo::tableName(), ['photo_id' => 'pk', 'class' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'image' => Schema::TYPE_STRING . '(128) NOT NULL', 'description' => Schema::TYPE_STRING . '(1024) NOT NULL', 'order_num' => Schema::TYPE_INTEGER . " NOT NULL"], $this->engine); //$this->createIndex('model_item', models\Photo::tableName(), ['class', 'item_id']); //SEOTEXT $this->createTable(models\SeoText::tableName(), ['seotext_id' => 'pk', 'class' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'h1' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'keywords' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'description' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine); //$this->createIndex('model_item', models\SeoText::tableName(), ['class', 'item_id'], true); //SETTINGS $this->createTable(models\Setting::tableName(), ['setting_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'value' => Schema::TYPE_STRING . '(1024) NOT NULL', 'visibility' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine); //$this->createIndex('name', models\Setting::tableName(), 'name', true); //CAROUSEL MODULE $this->createTable(Carousel::tableName(), ['carousel_id' => 'pk', 'image' => Schema::TYPE_STRING . '(128) NOT NULL', 'link' => Schema::TYPE_STRING . '(255) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //CATALOG MODULE $this->createTable(catalog\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'fields' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'tree' => Schema::TYPE_INTEGER, 'lft' => Schema::TYPE_INTEGER, 'rgt' => Schema::TYPE_INTEGER, 'depth' => Schema::TYPE_INTEGER, 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //$this->createIndex('slug', catalog\models\Category::tableName(), 'slug', true); $this->createTable(catalog\models\Item::tableName(), ['item_id' => 'pk', 'category_id' => Schema::TYPE_INTEGER, 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'description' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'available' => Schema::TYPE_INTEGER . " DEFAULT '1'", 'price' => Schema::TYPE_FLOAT . " DEFAULT '0'", 'discount' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'data' => Schema::TYPE_TEXT . ' NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //$this->createIndex('slug', catalog\models\Item::tableName(), 'slug', true); $this->createTable(catalog\models\ItemData::tableName(), ['data_id' => 'pk', 'item_id' => Schema::TYPE_INTEGER, 'name' => Schema::TYPE_STRING . '(128) NOT NULL', 'value' => Schema::TYPE_STRING . '(1024) DEFAULT NULL'], $this->engine); //$this->createIndex('item_id_name', catalog\models\ItemData::tableName(), ['item_id', 'name']); //$this->createIndex('value', catalog\models\ItemData::tableName(), 'value(300)'); //SHOPCART MODULE $this->createTable(shopcart\models\Order::tableName(), ['order_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'address' => Schema::TYPE_STRING . '(255) NOT NULL', 'phone' => Schema::TYPE_STRING . '(64) NOT NULL', 'email' => Schema::TYPE_STRING . '(128) NOT NULL', 'comment' => Schema::TYPE_STRING . '(1024) NOT NULL', 'remark' => Schema::TYPE_STRING . '(1024) NOT NULL', 'access_token' => Schema::TYPE_STRING . '(32) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'new' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine); $this->createTable(shopcart\models\Good::tableName(), ['good_id' => 'pk', 'order_id' => Schema::TYPE_INTEGER, 'item_id' => Schema::TYPE_INTEGER, 'count' => Schema::TYPE_INTEGER, 'options' => Schema::TYPE_STRING . '(255) NOT NULL', 'price' => Schema::TYPE_FLOAT . " DEFAULT '0'", 'discount' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $this->engine); //FEEDBACK MODULE $this->createTable(Feedback::tableName(), ['feedback_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'email' => Schema::TYPE_STRING . '(128) NOT NULL', 'phone' => Schema::TYPE_STRING . '(64) DEFAULT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'answer_subject' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'answer_text' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine); //FILE MODULE $this->createTable(File::tableName(), ['file_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'file' => Schema::TYPE_STRING . '(255) NOT NULL', 'size' => Schema::TYPE_INTEGER . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'downloads' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'order_num' => Schema::TYPE_INTEGER], $this->engine); //$this->createIndex('slug', File::tableName(), 'slug', true); //GALLERY MODULE $this->createTable(gallery\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'tree' => Schema::TYPE_INTEGER, 'lft' => Schema::TYPE_INTEGER, 'rgt' => Schema::TYPE_INTEGER, 'depth' => Schema::TYPE_INTEGER, 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //$this->createIndex('slug', gallery\models\Category::tableName(), 'slug', true); //GUESTBOOK MODULE $this->createTable(Guestbook::tableName(), ['guestbook_id' => 'pk', 'name' => Schema::TYPE_STRING . '(128) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'answer' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'email' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'new' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine); //NEWS MODULE $this->createTable(News::tableName(), ['news_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'short' => Schema::TYPE_STRING . '(1024) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'views' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //$this->createIndex('slug', News::tableName(), 'slug', true); //ARTICLE MODULE $this->createTable(article\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER, 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'tree' => Schema::TYPE_INTEGER, 'lft' => Schema::TYPE_INTEGER, 'rgt' => Schema::TYPE_INTEGER, 'depth' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //$this->createIndex('slug', article\models\Category::tableName(), 'slug', true); $this->createTable(article\models\Item::tableName(), ['item_id' => 'pk', 'category_id' => Schema::TYPE_INTEGER, 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'short' => Schema::TYPE_STRING . '(1024) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'views' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //$this->createIndex('slug', article\models\Item::tableName(), 'slug', true); //PAGE MODULE $this->createTable(Page::tableName(), ['page_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine); //$this->createIndex('slug', Page::tableName(), 'slug', true); //FAQ MODULE $this->createTable(Faq::tableName(), ['faq_id' => 'pk', 'question' => Schema::TYPE_TEXT . ' NOT NULL', 'answer' => Schema::TYPE_TEXT . ' NOT NULL', 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine); //SUBSCRIBE MODULE $this->createTable(Subscriber::tableName(), ['subscriber_id' => 'pk', 'email' => Schema::TYPE_STRING . '(128) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $this->engine); //$this->createIndex('email', Subscriber::tableName(), 'email', true); $this->createTable(History::tableName(), ['history_id' => 'pk', 'subject' => Schema::TYPE_STRING . '(128) NOT NULL', 'body' => Schema::TYPE_TEXT . ' NOT NULL', 'sent' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $this->engine); //TEXT MODULE $this->createTable(Text::tableName(), ['text_id' => 'pk', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine); //$this->createIndex('slug', Text::tableName(), 'slug', true); //Tags $this->createTable(models\Tag::tableName(), ['tag_id' => 'pk', 'name' => Schema::TYPE_STRING . '(128) NOT NULL', 'frequency' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $this->engine); //$this->createIndex('name', models\Tag::tableName(), 'name', true); $this->createTable(models\TagAssign::tableName(), ['class' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'tag_id' => Schema::TYPE_INTEGER . " NOT NULL"], $this->engine); //$this->createIndex('class', models\TagAssign::tableName(), 'class'); //$this->createIndex('item_tag', models\TagAssign::tableName(), ['item_id', 'tag_id']); //INSERT VERSION $this->delete(models\Setting::tableName(), ['name' => 'easyii_version']); $this->insert(models\Setting::tableName(), ['name' => 'easyii_version', 'value' => self::VERSION, 'title' => 'EasyiiCMS version', 'visibility' => models\Setting::VISIBLE_NONE]); }
public function getOrder() { if (!$this->_order) { $access_token = $this->token; if (!$access_token || !($order = Order::find()->where(['access_token' => $access_token])->status(Order::STATUS_BLANK)->one())) { $order = new Order(); } $this->_order = new OrderObject($order); } return $this->_order; }
?> </td> <td><?php echo $item->address; ?> </td> <td><?php echo $item->cost; ?> </td> <td><?php echo Yii::$app->formatter->asDatetime($item->time, 'short'); ?> </td> <td><?php echo Order::statusName($item->status); ?> </td> <td class="control"> <div class="btn-group btn-group-sm" role="group"> <a href="<?php echo Url::to(['/admin/' . $module . '/a/view', 'id' => $item->primaryKey]); ?> " class="btn btn-default" title="<?php echo Yii::t('easyii/shopcart', 'View'); ?> "><span class="glyphicon glyphicon-eye-open"></span></a> <a href="<?php echo Url::to(['/admin/' . $module . '/a/delete', 'id' => $item->primaryKey]); ?> " class="btn btn-default confirm-delete" title="<?php