Commit 3c14407f2d2ee607cf47ea71eef1552ac48175c9
Merge remote-tracking branch 'origin/master'
Showing
30 changed files
with
2785 additions
and
188 deletions
Show diff stats
backend/config/main.php
... | ... | @@ -11,15 +11,16 @@ |
11 | 11 | ); |
12 | 12 | |
13 | 13 | return [ |
14 | + 'language' => 'ru-RU', | |
14 | 15 | 'id' => 'app-backend', |
15 | 16 | 'homeUrl' => '/admin', |
16 | 17 | 'basePath' => dirname(__DIR__), |
17 | 18 | 'controllerNamespace' => 'backend\controllers', |
18 | 19 | 'bootstrap' => [ 'log' ], |
19 | 20 | 'controllerMap' => [ |
20 | - 'profile' => 'artbox\core\controllers\ProfileController', | |
21 | - 'page' => 'artbox\core\controllers\PageController', | |
22 | - 'alias' => 'artbox\core\controllers\AliasController', | |
21 | + 'profile' => 'artbox\core\controllers\ProfileController', | |
22 | + 'page' => 'artbox\core\controllers\PageController', | |
23 | + 'alias' => 'artbox\core\controllers\AliasController', | |
23 | 24 | 'seo' => 'artbox\core\controllers\SeoController', |
24 | 25 | 'feedback' => 'artbox\core\controllers\FeedbackController', |
25 | 26 | 'weblog-article' => 'artbox\weblog\controllers\ArticleController', |
... | ... | @@ -34,11 +35,16 @@ |
34 | 35 | 'variant-option-complementary' => 'artbox\catalog\controllers\VariantOptionComplController', |
35 | 36 | 'variant-option-exclusion' => 'artbox\catalog\controllers\VariantOptionExclController', |
36 | 37 | 'product-option-complementary' => 'artbox\catalog\controllers\ProductOptionComplController', |
37 | - 'product-option-exclusion' => 'artbox\catalog\controllers\ProductOptionExclController', | |
38 | - 'import' => 'artbox\catalog\controllers\ImportController', | |
39 | - 'blog-article' => 'artbox\weblog\controllers\ArticleController', | |
40 | - 'blog-category' => 'artbox\weblog\controllers\CategoryController', | |
41 | - 'blog-tag' => 'artbox\weblog\controllers\TagController', | |
38 | + 'product-option-exclusion' => 'artbox\catalog\controllers\ProductOptionExclController', | |
39 | + 'import' => 'artbox\catalog\controllers\ImportController', | |
40 | + 'blog-article' => 'artbox\weblog\controllers\ArticleController', | |
41 | + 'blog-category' => 'artbox\weblog\controllers\CategoryController', | |
42 | + 'blog-tag' => 'artbox\weblog\controllers\TagController', | |
43 | + 'order' => 'artbox\order\controllers\OrderController', | |
44 | + 'order-product' => 'artbox\order\controllers\OrderProductController', | |
45 | + 'label' => 'artbox\order\controllers\LabelController', | |
46 | + 'delivery' => 'artbox\order\controllers\DeliveryController', | |
47 | + 'payment' => 'artbox\order\controllers\PaymentController', | |
42 | 48 | ], |
43 | 49 | 'components' => [ |
44 | 50 | 'assetManager' => [ | ... | ... |
backend/views/layouts/main.php
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | use artbox\core\models\UserData; |
11 | 11 | use artbox\core\widgets\FeedbackWidget; |
12 | 12 | use artbox\core\widgets\FlashWidget; |
13 | + use artbox\order\assets\OrderAsset; | |
13 | 14 | use noam148\imagemanager\components\ImageManagerGetPath; |
14 | 15 | use yii\bootstrap\Html; |
15 | 16 | use yii\web\View; |
... | ... | @@ -17,6 +18,7 @@ |
17 | 18 | use yiister\gentelella\widgets\Menu; |
18 | 19 | |
19 | 20 | ArtboxCoreAsset::register($this); |
21 | + OrderAsset::register($this); | |
20 | 22 | |
21 | 23 | /** |
22 | 24 | * @var User $user | ... | ... |
backend/views/layouts/menu_items.php
... | ... | @@ -148,5 +148,32 @@ |
148 | 148 | ], |
149 | 149 | ], |
150 | 150 | ], |
151 | + [ | |
152 | + 'label' => \Yii::t('order', 'Order'), | |
153 | + 'url' => '#', | |
154 | + 'icon' => 'archive', | |
155 | + 'items' => [ | |
156 | + [ | |
157 | + 'label' => \Yii::t('order', 'Orders'), | |
158 | + 'url' => [ 'order/index' ], | |
159 | + 'icon' => 'first-order', | |
160 | + ], | |
161 | + [ | |
162 | + 'label' => \Yii::t('order', 'Label'), | |
163 | + 'url' => [ 'label/index' ], | |
164 | + 'icon' => 'tag', | |
165 | + ], | |
166 | + [ | |
167 | + 'label' => \Yii::t('order', 'Delivery'), | |
168 | + 'url' => [ 'delivery/index' ], | |
169 | + 'icon' => 'truck', | |
170 | + ], | |
171 | + [ | |
172 | + 'label' => \Yii::t('order', 'Payment'), | |
173 | + 'url' => [ 'payment/index' ], | |
174 | + 'icon' => 'money', | |
175 | + ], | |
176 | + ], | |
177 | + ], | |
151 | 178 | ] |
152 | 179 | ); |
153 | 180 | \ No newline at end of file | ... | ... |
common/config/main.php
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use artbox\order\models\Customer; | |
6 | + use Yii; | |
7 | + use yii\base\Model; | |
8 | + | |
9 | + /** | |
10 | + * Password reset request form | |
11 | + */ | |
12 | + class PasswordResetRequestForm extends Model | |
13 | + { | |
14 | + public $email; | |
15 | + /** | |
16 | + * @inheritdoc | |
17 | + */ | |
18 | + public function rules() | |
19 | + { | |
20 | + return [ | |
21 | + [ | |
22 | + 'email', | |
23 | + 'trim', | |
24 | + ], | |
25 | + [ | |
26 | + 'email', | |
27 | + 'required', | |
28 | + ], | |
29 | + [ | |
30 | + 'email', | |
31 | + 'email', | |
32 | + ], | |
33 | + [ | |
34 | + 'email', | |
35 | + 'exist', | |
36 | + 'targetClass' => '\artbox\order\models\Customer', | |
37 | + 'filter' => [ 'status' => Customer::STATUS_ACTIVE ], | |
38 | + 'message' => 'There is no user with this email address.', | |
39 | + ], | |
40 | + ]; | |
41 | + } | |
42 | + /** | |
43 | + * Sends an email with a link, for resetting the password. | |
44 | + * | |
45 | + * @return bool whether the email was send | |
46 | + */ | |
47 | + public function sendEmail() | |
48 | + { | |
49 | + /* @var $user Customer */ | |
50 | + $user = Customer::findOne( | |
51 | + [ | |
52 | + 'status' => Customer::STATUS_ACTIVE, | |
53 | + 'email' => $this->email, | |
54 | + ] | |
55 | + ); | |
56 | + if (!$user) { | |
57 | + return false; | |
58 | + } | |
59 | + | |
60 | + if (!Customer::isPasswordResetTokenValid($user->password_reset_token)) { | |
61 | + $user->generatePasswordResetToken(); | |
62 | + if (!$user->save()) { | |
63 | + return false; | |
64 | + } | |
65 | + } | |
66 | + return Yii::$app->mailer->compose( | |
67 | + [ | |
68 | + 'html' => 'passwordResetToken-html', | |
69 | + 'text' => 'passwordResetToken-text', | |
70 | + ], | |
71 | + [ 'user' => $user ] | |
72 | + ) | |
73 | + ->setFrom([ Yii::$app->params[ 'supportEmail' ] => Yii::$app->name . ' robot' ]) | |
74 | + ->setTo($this->email) | |
75 | + ->setSubject('Password reset for ' . Yii::$app->name) | |
76 | + ->send(); | |
77 | + } | |
78 | + } | |
0 | 79 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use artbox\order\models\Customer; | |
6 | + use yii\base\Model; | |
7 | + use yii\base\InvalidParamException; | |
8 | + | |
9 | + /** | |
10 | + * Password reset form | |
11 | + */ | |
12 | + class ResetPasswordForm extends Model | |
13 | + { | |
14 | + public $password; | |
15 | + | |
16 | + /** | |
17 | + * @var \artbox\order\models\Customer | |
18 | + */ | |
19 | + private $_user; | |
20 | + | |
21 | + /** | |
22 | + * Creates a form model given a token. | |
23 | + * | |
24 | + * @param string $token | |
25 | + * @param array $config name-value pairs that will be used to initialize the object properties | |
26 | + * | |
27 | + * @throws \yii\base\InvalidParamException if token is empty or not valid | |
28 | + */ | |
29 | + public function __construct($token, $config = []) | |
30 | + { | |
31 | + if (empty($token) || !is_string($token)) { | |
32 | + throw new InvalidParamException('Password reset token cannot be blank.'); | |
33 | + } | |
34 | + $this->_user = Customer::findByPasswordResetToken($token); | |
35 | + if (!$this->_user) { | |
36 | + throw new InvalidParamException('Wrong password reset token.'); | |
37 | + } | |
38 | + parent::__construct($config); | |
39 | + } | |
40 | + | |
41 | + /** | |
42 | + * @inheritdoc | |
43 | + */ | |
44 | + public function rules() | |
45 | + { | |
46 | + return [ | |
47 | + [ | |
48 | + 'password', | |
49 | + 'required', | |
50 | + ], | |
51 | + [ | |
52 | + 'password', | |
53 | + 'string', | |
54 | + 'min' => 6, | |
55 | + ], | |
56 | + ]; | |
57 | + } | |
58 | + | |
59 | + /** | |
60 | + * Resets password. | |
61 | + * | |
62 | + * @return bool if password was reset. | |
63 | + */ | |
64 | + public function resetPassword() | |
65 | + { | |
66 | + $user = $this->_user; | |
67 | + $user->setPassword($this->password); | |
68 | + $user->removePasswordResetToken(); | |
69 | + | |
70 | + return $user->save(false); | |
71 | + } | |
72 | + } | |
0 | 73 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use artbox\order\models\Customer; | |
6 | + use yii\base\Model; | |
7 | + | |
8 | + /** | |
9 | + * Signup form | |
10 | + */ | |
11 | + class SignupForm extends Model | |
12 | + { | |
13 | + public $username; | |
14 | + public $email; | |
15 | + public $password; | |
16 | + | |
17 | + /** | |
18 | + * @inheritdoc | |
19 | + */ | |
20 | + public function rules() | |
21 | + { | |
22 | + return [ | |
23 | + [ | |
24 | + 'username', | |
25 | + 'trim', | |
26 | + ], | |
27 | + [ | |
28 | + 'username', | |
29 | + 'required', | |
30 | + ], | |
31 | + [ | |
32 | + 'username', | |
33 | + 'unique', | |
34 | + 'targetClass' => '\artbox\order\models\Customer', | |
35 | + 'message' => 'This username has already been taken.', | |
36 | + ], | |
37 | + [ | |
38 | + 'username', | |
39 | + 'string', | |
40 | + 'min' => 2, | |
41 | + 'max' => 255, | |
42 | + ], | |
43 | + | |
44 | + [ | |
45 | + 'email', | |
46 | + 'trim', | |
47 | + ], | |
48 | + [ | |
49 | + 'email', | |
50 | + 'required', | |
51 | + ], | |
52 | + [ | |
53 | + 'email', | |
54 | + 'email', | |
55 | + ], | |
56 | + [ | |
57 | + 'email', | |
58 | + 'string', | |
59 | + 'max' => 255, | |
60 | + ], | |
61 | + [ | |
62 | + 'email', | |
63 | + 'unique', | |
64 | + 'targetClass' => '\artbox\order\models\Customer', | |
65 | + 'message' => 'This email address has already been taken.', | |
66 | + ], | |
67 | + | |
68 | + [ | |
69 | + 'password', | |
70 | + 'required', | |
71 | + ], | |
72 | + [ | |
73 | + 'password', | |
74 | + 'string', | |
75 | + 'min' => 6, | |
76 | + ], | |
77 | + ]; | |
78 | + } | |
79 | + | |
80 | + /** | |
81 | + * Signs user up. | |
82 | + * | |
83 | + * @return \artbox\order\models\Customer|null the saved model or null if saving fails | |
84 | + */ | |
85 | + public function signup() | |
86 | + { | |
87 | + if (!$this->validate()) { | |
88 | + return null; | |
89 | + } | |
90 | + | |
91 | + $user = new Customer(); | |
92 | + $user->username = $this->username; | |
93 | + $user->email = $this->email; | |
94 | + $user->setPassword($this->password); | |
95 | + $user->generateAuthKey(); | |
96 | + | |
97 | + return $user->save() ? $user : null; | |
98 | + } | |
99 | + } | |
0 | 100 | \ No newline at end of file | ... | ... |
frontend/assets/AppAsset.php
frontend/config/main.php
1 | 1 | <?php |
2 | 2 | use artbox\core\components\LanguageRequest; |
3 | 3 | use artbox\core\components\SeoUrlManager; |
4 | + use artbox\order\models\Basket; | |
4 | 5 | |
5 | 6 | $params = array_merge( |
6 | 7 | require( __DIR__ . '/../../common/config/params.php' ), |
... | ... | @@ -15,6 +16,9 @@ |
15 | 16 | 'basePath' => dirname(__DIR__), |
16 | 17 | 'bootstrap' => [ 'log' ], |
17 | 18 | 'controllerNamespace' => 'frontend\controllers', |
19 | + 'controllerMap' => [ | |
20 | + 'basket' => 'artbox\order\controllers\BasketController', | |
21 | + ], | |
18 | 22 | 'components' => [ |
19 | 23 | 'request' => [ |
20 | 24 | 'class' => LanguageRequest::className(), |
... | ... | @@ -22,7 +26,7 @@ |
22 | 26 | 'baseUrl' => '/', |
23 | 27 | ], |
24 | 28 | 'user' => [ |
25 | - 'identityClass' => 'common\models\User', | |
29 | + 'identityClass' => 'artbox\order\models\Customer', | |
26 | 30 | 'enableAutoLogin' => true, |
27 | 31 | 'identityCookie' => [ |
28 | 32 | 'name' => '_identity-frontend', |
... | ... | @@ -69,6 +73,9 @@ |
69 | 73 | 'robots.txt' => 'site/robots', |
70 | 74 | ], |
71 | 75 | ], |
76 | + 'basket' => [ | |
77 | + 'class' => Basket::className(), | |
78 | + ], | |
72 | 79 | ], |
73 | 80 | 'params' => $params, |
74 | 81 | ]; | ... | ... |
frontend/config/params.php
1 | +<?php | |
2 | + | |
3 | + namespace frontend\controllers; | |
4 | + | |
5 | + use artbox\order\models\Delivery; | |
6 | + use artbox\order\models\OrderProduct; | |
7 | + use artbox\order\models\Payment; | |
8 | + use frontend\models\Order; | |
9 | + use yii\web\Controller; | |
10 | + | |
11 | + /** | |
12 | + * Class CheckoutController | |
13 | + * | |
14 | + * @package frontend\controllers | |
15 | + */ | |
16 | + class CheckoutController extends Controller | |
17 | + { | |
18 | + public function actionIndex() | |
19 | + { | |
20 | + /** | |
21 | + * @var \artbox\order\models\Basket $basket | |
22 | + */ | |
23 | + $basket = \Yii::$app->get('basket'); | |
24 | + $data = $basket->getData(); | |
25 | + $variants = []; | |
26 | + if (!empty($data)) { | |
27 | + $variants = $basket->findModels(array_keys($data)); | |
28 | + } | |
29 | + return $this->render( | |
30 | + 'index', | |
31 | + [ | |
32 | + 'basket' => $basket, | |
33 | + 'variants' => $variants, | |
34 | + ] | |
35 | + ); | |
36 | + } | |
37 | + | |
38 | + public function actionInfo() | |
39 | + { | |
40 | + $model = new Order( | |
41 | + [ | |
42 | + 'scenario' => Order::SCENARIO_INFO, | |
43 | + ] | |
44 | + ); | |
45 | + if (!\Yii::$app->user->isGuest) { | |
46 | + /** | |
47 | + * @var \artbox\order\models\Customer $user | |
48 | + */ | |
49 | + $user = \Yii::$app->user->identity; | |
50 | + $model->name = $user->name; | |
51 | + $model->email = $user->email; | |
52 | + $model->phone = $user->phone; | |
53 | + $model->city = $user->city; | |
54 | + $model->address = $user->address; | |
55 | + } | |
56 | + $model->loadActive(); | |
57 | + if ($model->load(\Yii::$app->request->post()) && $model->validate()) { | |
58 | + $model->saveActive(); | |
59 | + return $this->redirect([ 'delivery' ]); | |
60 | + } | |
61 | + return $this->render( | |
62 | + 'info', | |
63 | + [ | |
64 | + 'model' => $model, | |
65 | + ] | |
66 | + ); | |
67 | + } | |
68 | + | |
69 | + public function actionDelivery() | |
70 | + { | |
71 | + $model = new Order( | |
72 | + [ | |
73 | + 'scenario' => Order::SCENARIO_INFO, | |
74 | + ] | |
75 | + ); | |
76 | + if (!empty($order = \Yii::$app->session->get('order')) && $model->load($order, '') && $model->validate()) { | |
77 | + $model->scenario = Order::SCENARIO_DELIVERY; | |
78 | + $model->loadActive(); | |
79 | + if ($model->load(\Yii::$app->request->post()) && $model->validate()) { | |
80 | + $model->saveActive(); | |
81 | + return $this->redirect([ 'payment' ]); | |
82 | + } | |
83 | + } else { | |
84 | + return $this->redirect([ 'info' ]); | |
85 | + } | |
86 | + $deliveries = Delivery::find() | |
87 | + ->with('lang') | |
88 | + ->where([ 'status' => true ]) | |
89 | + ->orderBy([ 'sort' => SORT_ASC ]) | |
90 | + ->all(); | |
91 | + return $this->render( | |
92 | + 'delivery', | |
93 | + [ | |
94 | + 'model' => $model, | |
95 | + 'deliveries' => $deliveries, | |
96 | + ] | |
97 | + ); | |
98 | + } | |
99 | + | |
100 | + public function actionPayment() | |
101 | + { | |
102 | + $model = new Order( | |
103 | + [ | |
104 | + 'scenario' => Order::SCENARIO_INFO, | |
105 | + ] | |
106 | + ); | |
107 | + $order = \Yii::$app->session->get('order'); | |
108 | + if (!empty($model)) { | |
109 | + if ($model->load($order, '') && $model->validate()) { | |
110 | + $model->scenario = Order::SCENARIO_DELIVERY; | |
111 | + if ($model->load($order, '') && $model->validate()) { | |
112 | + $model->scenario = Order::SCENARIO_PAYMENT; | |
113 | + $model->loadActive(); | |
114 | + if ($model->load(\Yii::$app->request->post()) && $model->validate()) { | |
115 | + $model->saveActive(); | |
116 | + return $this->redirect('confirm'); | |
117 | + } else { | |
118 | + $payments = Payment::find() | |
119 | + ->with('lang') | |
120 | + ->where([ 'status' => true ]) | |
121 | + ->orderBy([ 'sort' => SORT_ASC ]) | |
122 | + ->all(); | |
123 | + return $this->render( | |
124 | + 'payment', | |
125 | + [ | |
126 | + 'model' => $model, | |
127 | + 'payments' => $payments, | |
128 | + ] | |
129 | + ); | |
130 | + } | |
131 | + } | |
132 | + } | |
133 | + } | |
134 | + return $this->redirect( | |
135 | + 'delivery' | |
136 | + ); | |
137 | + } | |
138 | + | |
139 | + public function actionConfirm() | |
140 | + { | |
141 | + $model = new Order(); | |
142 | + $order = \Yii::$app->session->get('order'); | |
143 | + $model->load($order, ''); | |
144 | + if (!$model->validate()) { | |
145 | + return $this->redirect([ 'payment' ]); | |
146 | + } | |
147 | + if (\Yii::$app->request->isPost) { | |
148 | + $model->label_id = 1; | |
149 | + $model->save(false); | |
150 | + /** | |
151 | + * @var \artbox\order\models\Basket $basket | |
152 | + */ | |
153 | + $basket = \Yii::$app->get('basket'); | |
154 | + foreach ($basket->findModels(array_keys($basket->getData())) as $variant) { | |
155 | + $orderProduct = new OrderProduct( | |
156 | + [ | |
157 | + 'order_id' => $model->id, | |
158 | + 'variant_id' => $variant->id, | |
159 | + 'sku' => $variant->sku, | |
160 | + 'price' => $variant->price, | |
161 | + 'count' => $basket->getItem($variant->id)[ 'count' ], | |
162 | + ] | |
163 | + ); | |
164 | + $orderProduct->save(); | |
165 | + } | |
166 | + \Yii::$app->session->remove('order'); | |
167 | + $basket->clear(); | |
168 | + return $this->redirect([ 'site/index' ]); | |
169 | + } | |
170 | + return $this->render( | |
171 | + 'confirm', | |
172 | + [ | |
173 | + 'model' => $model, | |
174 | + ] | |
175 | + ); | |
176 | + } | |
177 | + | |
178 | + public function beforeAction($action) | |
179 | + { | |
180 | + /** | |
181 | + * @var \artbox\order\models\Basket $basket | |
182 | + */ | |
183 | + $basket = \Yii::$app->get('basket'); | |
184 | + if ($action->id !== 'index' && empty($basket->getData())) { | |
185 | + return $this->redirect([ 'site/index' ]); | |
186 | + } | |
187 | + return parent::beforeAction($action); | |
188 | + } | |
189 | + } | |
190 | + | |
0 | 191 | \ No newline at end of file | ... | ... |
frontend/controllers/PageController.php
frontend/controllers/SiteController.php
1 | 1 | <?php |
2 | + | |
2 | 3 | namespace frontend\controllers; |
3 | - | |
4 | + | |
4 | 5 | use artbox\catalog\models\Brand; |
5 | 6 | use artbox\catalog\models\Category; |
6 | 7 | use artbox\catalog\models\Product; |
7 | 8 | use artbox\core\models\Feedback; |
9 | + use common\models\LoginForm; | |
10 | + use common\models\PasswordResetRequestForm; | |
11 | + use common\models\ResetPasswordForm; | |
8 | 12 | use common\models\Settings; |
13 | + use common\models\SignupForm; | |
9 | 14 | use Yii; |
15 | + use yii\base\InvalidParamException; | |
10 | 16 | use yii\web\BadRequestHttpException; |
11 | 17 | use yii\web\Controller; |
12 | 18 | use yii\filters\VerbFilter; |
... | ... | @@ -150,7 +156,7 @@ |
150 | 156 | public function actionFeedback() |
151 | 157 | { |
152 | 158 | Yii::$app->response->format = Response::FORMAT_JSON; |
153 | - if (empty( Yii::$app->request->post() )) { | |
159 | + if (empty(Yii::$app->request->post())) { | |
154 | 160 | throw new BadRequestHttpException(); |
155 | 161 | } else { |
156 | 162 | $model = new Feedback(); |
... | ... | @@ -173,4 +179,103 @@ |
173 | 179 | } |
174 | 180 | } |
175 | 181 | } |
182 | + | |
183 | + public function actionLogin() | |
184 | + { | |
185 | + if (!\Yii::$app->user->isGuest) { | |
186 | + return $this->redirect([ 'index' ]); | |
187 | + } | |
188 | + | |
189 | + $loginForm = new LoginForm(); | |
190 | + $signupForm = new SignupForm(); | |
191 | + if ($loginForm->load(\Yii::$app->request->post()) && $loginForm->login()) { | |
192 | + if (!empty($loginForm->returnUrl)) { | |
193 | + return $this->redirect($loginForm->returnUrl); | |
194 | + } else { | |
195 | + return $this->redirect([ 'index' ]); | |
196 | + } | |
197 | + } | |
198 | + if ($signupForm->load(\Yii::$app->request->post())) { | |
199 | + if ($user = $signupForm->signup()) { | |
200 | + if (\Yii::$app->getUser() | |
201 | + ->login($user) | |
202 | + ) { | |
203 | + return $this->redirect([ 'index' ]); | |
204 | + } | |
205 | + } | |
206 | + } | |
207 | + return $this->render( | |
208 | + 'login', | |
209 | + [ | |
210 | + 'loginForm' => $loginForm, | |
211 | + 'signupForm' => $signupForm, | |
212 | + ] | |
213 | + ); | |
214 | + } | |
215 | + | |
216 | + public function actionLogout() | |
217 | + { | |
218 | + \Yii::$app->user->logout(); | |
219 | + | |
220 | + return $this->redirect([ 'index' ]); | |
221 | + } | |
222 | + | |
223 | + /** | |
224 | + * Requests password reset. | |
225 | + * | |
226 | + * @return mixed | |
227 | + */ | |
228 | + public function actionRequestPasswordReset() | |
229 | + { | |
230 | + $model = new PasswordResetRequestForm(); | |
231 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |
232 | + if ($model->sendEmail()) { | |
233 | + Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); | |
234 | + | |
235 | + return $this->redirect([ 'index' ]); | |
236 | + } else { | |
237 | + Yii::$app->session->setFlash( | |
238 | + 'error', | |
239 | + 'Sorry, we are unable to reset password for the provided email address.' | |
240 | + ); | |
241 | + } | |
242 | + } | |
243 | + | |
244 | + return $this->render( | |
245 | + 'requestPasswordResetToken', | |
246 | + [ | |
247 | + 'model' => $model, | |
248 | + ] | |
249 | + ); | |
250 | + } | |
251 | + | |
252 | + /** | |
253 | + * Resets password. | |
254 | + * | |
255 | + * @param string $token | |
256 | + * | |
257 | + * @return mixed | |
258 | + * @throws BadRequestHttpException | |
259 | + */ | |
260 | + public function actionResetPassword($token) | |
261 | + { | |
262 | + try { | |
263 | + $model = new ResetPasswordForm($token); | |
264 | + } catch (InvalidParamException $e) { | |
265 | + throw new BadRequestHttpException($e->getMessage()); | |
266 | + } | |
267 | + | |
268 | + if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { | |
269 | + Yii::$app->session->setFlash('success', 'New password saved.'); | |
270 | + | |
271 | + return $this->redirect([ 'index' ]); | |
272 | + } | |
273 | + | |
274 | + return $this->render( | |
275 | + 'resetPassword', | |
276 | + [ | |
277 | + 'model' => $model, | |
278 | + ] | |
279 | + ); | |
280 | + } | |
176 | 281 | } | ... | ... |
1 | +<?php | |
2 | + | |
3 | + namespace frontend\models; | |
4 | + | |
5 | + use artbox\order\models\Delivery; | |
6 | + use artbox\order\models\Payment; | |
7 | + | |
8 | + class Order extends \artbox\order\models\Order | |
9 | + { | |
10 | + const SCENARIO_INFO = 'info'; | |
11 | + const SCENARIO_DELIVERY = 'delivery'; | |
12 | + const SCENARIO_PAYMENT = 'payment'; | |
13 | + const SCENARIO_CONFIRM = 'confirm'; | |
14 | + | |
15 | + /** | |
16 | + * @inheritdoc | |
17 | + */ | |
18 | + public function scenarios() | |
19 | + { | |
20 | + return array_merge( | |
21 | + parent::scenarios(), | |
22 | + [ | |
23 | + self::SCENARIO_INFO => [ | |
24 | + 'name', | |
25 | + 'phone', | |
26 | + 'email', | |
27 | + 'city', | |
28 | + 'address', | |
29 | + 'comment', | |
30 | + ], | |
31 | + self::SCENARIO_DELIVERY => [ | |
32 | + 'delivery_id', | |
33 | + ], | |
34 | + self::SCENARIO_PAYMENT => [ | |
35 | + 'payment_id', | |
36 | + ], | |
37 | + ] | |
38 | + ); | |
39 | + } | |
40 | + | |
41 | + /** | |
42 | + * @inheritdoc | |
43 | + */ | |
44 | + public function rules() | |
45 | + { | |
46 | + return [ | |
47 | + [ | |
48 | + [ | |
49 | + 'name', | |
50 | + 'phone', | |
51 | + 'email', | |
52 | + 'delivery_id', | |
53 | + 'payment_id', | |
54 | + ], | |
55 | + 'required', | |
56 | + ], | |
57 | + [ | |
58 | + [ | |
59 | + 'name', | |
60 | + 'phone', | |
61 | + 'email', | |
62 | + 'city', | |
63 | + 'address', | |
64 | + ], | |
65 | + 'string', | |
66 | + 'max' => 255, | |
67 | + ], | |
68 | + [ | |
69 | + [ | |
70 | + 'comment', | |
71 | + ], | |
72 | + 'string', | |
73 | + ], | |
74 | + [ | |
75 | + [ | |
76 | + 'delivery_id', | |
77 | + 'payment_id', | |
78 | + ], | |
79 | + 'integer', | |
80 | + ], | |
81 | + [ | |
82 | + [ | |
83 | + 'delivery_id', | |
84 | + ], | |
85 | + 'exist', | |
86 | + 'targetClass' => Delivery::className(), | |
87 | + 'targetAttribute' => 'id', | |
88 | + ], | |
89 | + [ | |
90 | + [ | |
91 | + 'payment_id', | |
92 | + ], | |
93 | + 'exist', | |
94 | + 'targetClass' => Payment::className(), | |
95 | + 'targetAttribute' => 'id', | |
96 | + ], | |
97 | + ]; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * Save active attributes to session variable 'order' | |
102 | + */ | |
103 | + public function saveActive() | |
104 | + { | |
105 | + $order = \Yii::$app->session->get('order', []); | |
106 | + foreach ($this->activeAttributes() as $attribute) { | |
107 | + $order[ $attribute ] = $this->getAttribute($attribute); | |
108 | + } | |
109 | + \Yii::$app->session[ 'order' ] = $order; | |
110 | + } | |
111 | + | |
112 | + /** | |
113 | + * Load active attributes from session variable 'order' | |
114 | + */ | |
115 | + public function loadActive() | |
116 | + { | |
117 | + $order = \Yii::$app->session->get('order'); | |
118 | + if (!empty($order)) { | |
119 | + foreach ($this->activeAttributes() as $attribute) { | |
120 | + if (!empty($order[ $attribute ])) { | |
121 | + $this->setAttribute($attribute, $order[ $attribute ]); | |
122 | + } | |
123 | + } | |
124 | + } | |
125 | + } | |
126 | + } | |
0 | 127 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + use yii\bootstrap\Html; | |
3 | + use yii\web\View; | |
4 | + | |
5 | + /** | |
6 | + * @var View $this | |
7 | + * @var int $count | |
8 | + */ | |
9 | +?> | |
10 | +<span class="badge"><?= $count; ?></span> | |
11 | +<?php | |
12 | + echo Html::a( | |
13 | + Html::tag( | |
14 | + 'span', | |
15 | + \Yii::t('app', 'ะะพัะทะธะฝะฐ'), | |
16 | + [ | |
17 | + 'class' => 'sub-title', | |
18 | + ] | |
19 | + ), | |
20 | + [ | |
21 | + '/checkout/index', | |
22 | + ], | |
23 | + [ | |
24 | + 'class' => 'cart-item-link', | |
25 | + ] | |
26 | + ); | |
27 | +?> | ... | ... |
frontend/views/category/_product_item.php
... | ... | @@ -53,17 +53,31 @@ |
53 | 53 | ?></p> |
54 | 54 | <p class="buttons"> |
55 | 55 | <?php |
56 | - echo Html::a( | |
57 | - Html::tag( | |
58 | - 'i', | |
59 | - '', | |
56 | + if ($product->variants[ 0 ]->stock && $product->variants[ 0 ]->price) { | |
57 | + echo Html::a( | |
58 | + Html::tag( | |
59 | + 'i', | |
60 | + '', | |
61 | + [ | |
62 | + 'class' => 'fa fa-shopping-cart', | |
63 | + ] | |
64 | + ) . \Yii::t('app', 'ะ ะบะพัะทะธะฝั'), | |
65 | + '#', | |
60 | 66 | [ |
61 | - 'class' => 'fa fa-shopping-cart', | |
67 | + 'class' => 'btn btn-template-main add-to-basket', | |
68 | + 'data-id' => $product->variants[ 0 ]->id, | |
62 | 69 | ] |
63 | - ) . \Yii::t('app', 'ะ ะบะพัะทะธะฝั'), | |
64 | - '#', | |
65 | - [ 'class' => 'btn btn-template-main' ] | |
66 | - ); | |
70 | + ); | |
71 | + } else { | |
72 | + echo Html::a( | |
73 | + \Yii::t('app', 'ะะตั ะฒ ะฝะฐะปะธัะธะธ'), | |
74 | + '#', | |
75 | + [ | |
76 | + 'class' => 'btn btn-info disabled', | |
77 | + 'data-id' => $product->variants[ 0 ]->id, | |
78 | + ] | |
79 | + ); | |
80 | + } | |
67 | 81 | ?> |
68 | 82 | </p> |
69 | 83 | </div> | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var \yii\web\View $this | |
4 | + * @var \artbox\order\models\Basket $basket | |
5 | + * @var \frontend\models\Order $model | |
6 | + */ | |
7 | + | |
8 | + use artbox\core\helpers\ImageHelper; | |
9 | + use yii\bootstrap\ActiveForm; | |
10 | + use yii\bootstrap\Html; | |
11 | + | |
12 | + $formatter = \Yii::$app->formatter; | |
13 | + $basket = \Yii::$app->get('basket'); | |
14 | + $sum = 0; | |
15 | + $sumDiscount = 0; | |
16 | + $variants = $basket->findModels(array_keys($basket->getData())); | |
17 | + foreach ($variants as $variant) { | |
18 | + $count = $basket->getItem($variant->id)[ 'count' ]; | |
19 | + $sum += $variant->price * $count; | |
20 | + if (!empty($variant->price_old)) { | |
21 | + $sumDiscount += ( $variant->price_old - $variant->price ) * $count; | |
22 | + } | |
23 | + } | |
24 | +?> | |
25 | +<div id="content"> | |
26 | + <div class="container"> | |
27 | + | |
28 | + <div class="row"> | |
29 | + | |
30 | + <div class="col-md-9 clearfix" id="checkout"> | |
31 | + | |
32 | + <div class="box"> | |
33 | + <?php | |
34 | + $form = ActiveForm::begin(); | |
35 | + ?> | |
36 | + <ul class="nav nav-pills nav-justified"> | |
37 | + <?php | |
38 | + echo Html::tag( | |
39 | + 'li', | |
40 | + Html::a( | |
41 | + Html::icon( | |
42 | + 'map-marker', | |
43 | + [ | |
44 | + 'prefix' => 'fa fa-', | |
45 | + ] | |
46 | + ) . Html::tag('br') . \Yii::t('app', 'ะะดัะตั'), | |
47 | + [ 'checkout/info' ] | |
48 | + ) | |
49 | + ); | |
50 | + echo Html::tag( | |
51 | + 'li', | |
52 | + Html::a( | |
53 | + Html::icon( | |
54 | + 'truck', | |
55 | + [ | |
56 | + 'prefix' => 'fa fa-', | |
57 | + ] | |
58 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะดะพััะฐะฒะบะธ'), | |
59 | + [ 'checkout/delivery' ] | |
60 | + ) | |
61 | + ); | |
62 | + echo Html::tag( | |
63 | + 'li', | |
64 | + Html::a( | |
65 | + Html::icon( | |
66 | + 'money', | |
67 | + [ | |
68 | + 'prefix' => 'fa fa-', | |
69 | + ] | |
70 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะพะฟะปะฐัั'), | |
71 | + [ | |
72 | + 'checkout/payment', | |
73 | + ] | |
74 | + ) | |
75 | + ); | |
76 | + echo Html::tag( | |
77 | + 'li', | |
78 | + Html::a( | |
79 | + Html::icon( | |
80 | + 'eye', | |
81 | + [ | |
82 | + 'prefix' => 'fa fa-', | |
83 | + ] | |
84 | + ) . Html::tag('br') . \Yii::t('app', 'ะัะพัะผะพัั ะทะฐะบะฐะทะฐ'), | |
85 | + '#' | |
86 | + ), | |
87 | + [ | |
88 | + 'class' => 'active', | |
89 | + ] | |
90 | + ); | |
91 | + ?> | |
92 | + </ul> | |
93 | + | |
94 | + <div class="content"> | |
95 | + <div class="table-responsive"> | |
96 | + <table class="table"> | |
97 | + <thead> | |
98 | + <tr> | |
99 | + <th colspan="2"><?php echo \Yii::t('app', 'Product'); ?></th> | |
100 | + <th><?php echo \Yii::t('app', 'Quantity'); ?></th> | |
101 | + <th><?php echo \Yii::t('app', 'Unit price'); ?></th> | |
102 | + <th><?php echo \Yii::t('app', 'Discount'); ?></th> | |
103 | + <th><?php echo \Yii::t('app', 'Total'); ?></th> | |
104 | + </tr> | |
105 | + </thead> | |
106 | + <tbody> | |
107 | + <?php | |
108 | + foreach ($variants as $variant) { | |
109 | + ?> | |
110 | + <tr> | |
111 | + <td> | |
112 | + <?php | |
113 | + echo Html::a( | |
114 | + ImageHelper::set($variant->product->image->getPath()) | |
115 | + ->fillResize(50, 50) | |
116 | + ->renderImage( | |
117 | + [ | |
118 | + 'alt' => $variant->product->lang->title, | |
119 | + 'title' => $variant->product->lang->title, | |
120 | + ] | |
121 | + ), | |
122 | + [ | |
123 | + 'product/view', | |
124 | + 'id' => $variant->product->id, | |
125 | + ], | |
126 | + [ 'target' => '_blank' ] | |
127 | + ) | |
128 | + ?> | |
129 | + </td> | |
130 | + <td> | |
131 | + <?php | |
132 | + echo Html::a( | |
133 | + $variant->product->lang->title, | |
134 | + [ | |
135 | + 'product/view', | |
136 | + 'id' => $variant->product->id, | |
137 | + ], | |
138 | + [ 'target' => '_blank' ] | |
139 | + ) | |
140 | + ?> | |
141 | + </td> | |
142 | + <td><?php | |
143 | + if (!empty($item = $basket->getItem($variant->id))) { | |
144 | + echo $item[ 'count' ]; | |
145 | + } | |
146 | + ?></td> | |
147 | + <td><?php echo ( $variant->price ? : 0 ) . ' ะณัะฝ.'; ?></td> | |
148 | + <td><?php echo ( ( $variant->price_old - $variant->price ) ? : 0 ) . ' ะณัะฝ.'; ?></td> | |
149 | + <td><?php echo $variant->price * $item[ 'count' ] . ' ะณัะฝ.'; ?></td> | |
150 | + </tr> | |
151 | + <?php | |
152 | + } | |
153 | + ?> | |
154 | + </tbody> | |
155 | + <tfoot> | |
156 | + <tr> | |
157 | + <th colspan="5"><?php echo \Yii::t('app', 'Total'); ?></th> | |
158 | + <th><?php echo $sum; ?> ะณัะฝ.</th> | |
159 | + </tr> | |
160 | + </tfoot> | |
161 | + </table> | |
162 | + | |
163 | + </div> | |
164 | + <!-- /.table-responsive --> | |
165 | + </div> | |
166 | + <!-- /.content --> | |
167 | + | |
168 | + <div class="box-footer"> | |
169 | + <div class="pull-left"> | |
170 | + <?php | |
171 | + echo Html::a( | |
172 | + Html::icon( | |
173 | + 'chevron-left', | |
174 | + [ | |
175 | + 'prefix' => 'fa fa-', | |
176 | + ] | |
177 | + ) . \Yii::t('app', 'Back to payment method'), | |
178 | + [ | |
179 | + 'checkout/payment', | |
180 | + ], | |
181 | + [ | |
182 | + 'class' => 'btn btn-default', | |
183 | + ] | |
184 | + ) | |
185 | + ?> | |
186 | + </div> | |
187 | + <div class="pull-right"> | |
188 | + <?php | |
189 | + echo Html::submitButton( | |
190 | + \Yii::t('app', 'ะัะพัะผะธัั ะทะฐะบะฐะท'), | |
191 | + [ | |
192 | + 'class' => 'btn btn-success', | |
193 | + ] | |
194 | + ); | |
195 | + ?> | |
196 | + </div> | |
197 | + </div> | |
198 | + <?php | |
199 | + $form::end(); | |
200 | + ?> | |
201 | + </div> | |
202 | + <!-- /.box --> | |
203 | + | |
204 | + | |
205 | + </div> | |
206 | + <!-- /.col-md-9 --> | |
207 | + | |
208 | + <div class="col-md-3"> | |
209 | + <div class="box" id="order-summary"> | |
210 | + <div class="box-header"> | |
211 | + <h3><?php echo \Yii::t('app', 'ะัะพะณะพะฒัะน ััะตั'); ?></h3> | |
212 | + </div> | |
213 | + <p class="text-muted small"><?php echo \Yii::t( | |
214 | + 'app', | |
215 | + 'ะกัะพะธะผะพััั ะดะพััะฐะฒะบะธ ัะฐัััะธััะฒะฐะตััั ะฒ ะทะฐะฒะธัะธะผะพััะธ ะพั ะฐะดัะตัะฐ ะธ ัะฟะพัะพะฑะฐ ะดะพััะฐะฒะบะธ' | |
216 | + ); ?></p> | |
217 | + | |
218 | + <div class="table-responsive"> | |
219 | + <table class="table"> | |
220 | + <tbody> | |
221 | + <tr> | |
222 | + <td><?php echo \Yii::t('app', 'ะัะตะณะพ ะทะฐ ัะพะฒะฐัั'); ?></td> | |
223 | + <th><?php echo $sum; ?> ะณัะฝ.</th> | |
224 | + </tr> | |
225 | + <tr> | |
226 | + <td><?php echo \Yii::t('app', 'ะกัะผะผะฐ ัะบะธะดะบะธ'); ?></td> | |
227 | + <th><?php echo $sumDiscount; ?> ะณัะฝ.</th> | |
228 | + </tr> | |
229 | + <tr> | |
230 | + <td><?php echo \Yii::t('app', 'ะกัะพะธะผะพััั ะดะพััะฐะฒะบะธ'); ?></td> | |
231 | + <th><?php echo $model->delivery->value; ?> ะณัะฝ.</th> | |
232 | + </tr> | |
233 | + <tr class="total"> | |
234 | + <td><?php echo \Yii::t('app', 'ะัะพะณะพ ะบ ะพะฟะปะฐัะต'); ?></td> | |
235 | + <th><?php echo $sum + $model->delivery->value; ?> ะณัะฝ.</th> | |
236 | + </tr> | |
237 | + </tbody> | |
238 | + </table> | |
239 | + </div> | |
240 | + </div> | |
241 | + </div> | |
242 | + <!-- /.col-md-3 --> | |
243 | + </div> | |
244 | + <!-- /.row --> | |
245 | + | |
246 | + </div> | |
247 | + <!-- /.container --> | |
248 | +</div> | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var \yii\web\View $this | |
4 | + * @var \frontend\models\Order $model | |
5 | + * @var \artbox\order\models\Delivery[] $deliveries | |
6 | + * @var \artbox\order\models\Basket $basket | |
7 | + */ | |
8 | + use yii\bootstrap\ActiveForm; | |
9 | + use yii\bootstrap\Html; | |
10 | + | |
11 | + $formatter = \Yii::$app->formatter; | |
12 | + $basket = \Yii::$app->get('basket'); | |
13 | + $sum = 0; | |
14 | + $sumDiscount = 0; | |
15 | + foreach ($basket->findModels(array_keys($basket->getData())) as $variant) { | |
16 | + $count = $basket->getItem($variant->id)[ 'count' ]; | |
17 | + $sum += $variant->price * $count; | |
18 | + if (!empty($variant->price_old)) { | |
19 | + $sumDiscount += ( $variant->price_old - $variant->price ) * $count; | |
20 | + } | |
21 | + } | |
22 | +?> | |
23 | +<div id="content"> | |
24 | + <div class="container"> | |
25 | + | |
26 | + <div class="row"> | |
27 | + | |
28 | + <div class="col-md-9 clearfix" id="checkout"> | |
29 | + | |
30 | + <div class="box"> | |
31 | + <?php | |
32 | + $form = ActiveForm::begin(); | |
33 | + ?> | |
34 | + <ul class="nav nav-pills nav-justified"> | |
35 | + <?php | |
36 | + echo Html::tag( | |
37 | + 'li', | |
38 | + Html::a( | |
39 | + Html::icon( | |
40 | + 'map-marker', | |
41 | + [ | |
42 | + 'prefix' => 'fa fa-', | |
43 | + ] | |
44 | + ) . Html::tag('br') . \Yii::t('app', 'ะะดัะตั'), | |
45 | + [ 'checkout/info' ] | |
46 | + ) | |
47 | + ); | |
48 | + echo Html::tag( | |
49 | + 'li', | |
50 | + Html::a( | |
51 | + Html::icon( | |
52 | + 'truck', | |
53 | + [ | |
54 | + 'prefix' => 'fa fa-', | |
55 | + ] | |
56 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะดะพััะฐะฒะบะธ'), | |
57 | + '#' | |
58 | + ), | |
59 | + [ | |
60 | + 'class' => 'active', | |
61 | + ] | |
62 | + ); | |
63 | + echo Html::tag( | |
64 | + 'li', | |
65 | + Html::a( | |
66 | + Html::icon( | |
67 | + 'money', | |
68 | + [ | |
69 | + 'prefix' => 'fa fa-', | |
70 | + ] | |
71 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะพะฟะปะฐัั'), | |
72 | + [ | |
73 | + 'checkout/payment', | |
74 | + ] | |
75 | + ), | |
76 | + [ | |
77 | + 'class' => 'disabled', | |
78 | + ] | |
79 | + ); | |
80 | + echo Html::tag( | |
81 | + 'li', | |
82 | + Html::a( | |
83 | + Html::icon( | |
84 | + 'eye', | |
85 | + [ | |
86 | + 'prefix' => 'fa fa-', | |
87 | + ] | |
88 | + ) . Html::tag('br') . \Yii::t('app', 'ะัะพัะผะพัั ะทะฐะบะฐะทะฐ'), | |
89 | + [ | |
90 | + 'checkout/confirm', | |
91 | + ] | |
92 | + ), | |
93 | + [ | |
94 | + 'class' => 'disabled', | |
95 | + ] | |
96 | + ); | |
97 | + ?> | |
98 | + </ul> | |
99 | + | |
100 | + | |
101 | + <div class="content"> | |
102 | + <div class="row"> | |
103 | + <?php | |
104 | + if ($model->hasErrors()) { | |
105 | + echo Html::tag( | |
106 | + 'p', | |
107 | + \Yii::t('app', 'Please choose delivery method.'), | |
108 | + [ | |
109 | + 'class' => 'text-danger', | |
110 | + ] | |
111 | + ); | |
112 | + } | |
113 | + foreach ($deliveries as $index => $delivery) { | |
114 | + ?> | |
115 | + <div class="col-sm-4"> | |
116 | + <div class="box shipping-method"> | |
117 | + | |
118 | + <div class="box-header text-center"> | |
119 | + <?php | |
120 | + echo $form->field( | |
121 | + $model, | |
122 | + 'delivery_id', | |
123 | + [ | |
124 | + 'options' => [ | |
125 | + 'class' => 'form-group order-radio', | |
126 | + ], | |
127 | + ] | |
128 | + ) | |
129 | + ->radio( | |
130 | + [ | |
131 | + 'uncheck' => ( $index === 0 ) ? 0 : null, | |
132 | + 'label' => null, | |
133 | + 'tag' => false, | |
134 | + 'value' => $delivery->id, | |
135 | + ] | |
136 | + ) | |
137 | + ->label(false) | |
138 | + ->error(false); | |
139 | + ?> | |
140 | + <h4><?php echo $delivery->lang->title; ?></h4> | |
141 | + </div> | |
142 | + | |
143 | + <p><?php echo $delivery->lang->description; ?></p> | |
144 | + | |
145 | + </div> | |
146 | + </div> | |
147 | + <?php | |
148 | + } | |
149 | + ?> | |
150 | + </div> | |
151 | + <!-- /.row --> | |
152 | + | |
153 | + </div> | |
154 | + <!-- /.content --> | |
155 | + | |
156 | + <div class="box-footer"> | |
157 | + <div class="pull-left"> | |
158 | + <?php | |
159 | + echo Html::a( | |
160 | + Html::icon( | |
161 | + 'chevron-left', | |
162 | + [ | |
163 | + 'prefix' => 'fa fa-', | |
164 | + ] | |
165 | + ) . \Yii::t('app', 'ะะดัะตั ะธ ะธะฝัะพัะผะฐัะธั'), | |
166 | + [ | |
167 | + 'checkout/info', | |
168 | + ], | |
169 | + [ | |
170 | + 'class' => 'btn btn-default', | |
171 | + ] | |
172 | + ); | |
173 | + ?> | |
174 | + </div> | |
175 | + <div class="pull-right"> | |
176 | + <?php | |
177 | + echo Html::submitButton( | |
178 | + \Yii::t('app', 'ะะตัะตะนัะธ ะบ ะฒัะฑะพัั ัะฟะพัะพะฑะฐ ะพะฟะปะฐัั') . Html::icon( | |
179 | + 'chevron-right', | |
180 | + [ | |
181 | + 'prefix' => 'fa fa-', | |
182 | + ] | |
183 | + ), | |
184 | + [ | |
185 | + 'class' => 'btn btn-success', | |
186 | + ] | |
187 | + ); | |
188 | + ?> | |
189 | + </div> | |
190 | + </div> | |
191 | + <?php | |
192 | + $form::end(); | |
193 | + ?> | |
194 | + </div> | |
195 | + <!-- /.box --> | |
196 | + | |
197 | + | |
198 | + </div> | |
199 | + <!-- /.col-md-9 --> | |
200 | + | |
201 | + <div class="col-md-3"> | |
202 | + <div class="box" id="order-summary"> | |
203 | + <div class="box-header"> | |
204 | + <h3>ะัะพะณะพะฒัะน ััะตั</h3> | |
205 | + </div> | |
206 | + <p class="text-muted small"><?php echo \Yii::t( | |
207 | + 'app', | |
208 | + 'ะกัะพะธะผะพััั ะดะพััะฐะฒะบะธ ัะฐัััะธััะฒะฐะตััั ะฒ ะทะฐะฒะธัะธะผะพััะธ ะพั ะฐะดัะตัะฐ ะธ ัะฟะพัะพะฑะฐ ะดะพััะฐะฒะบะธ' | |
209 | + ); ?></p> | |
210 | + | |
211 | + <div class="table-responsive"> | |
212 | + <table class="table"> | |
213 | + <tbody> | |
214 | + <tr> | |
215 | + <td><?php echo \Yii::t('app', 'ะัะตะณะพ ะทะฐ ัะพะฒะฐัั'); ?></td> | |
216 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
217 | + </tr> | |
218 | + <tr> | |
219 | + <td><?php echo \Yii::t('app', 'ะกัะผะผะฐ ัะบะธะดะบะธ'); ?></td> | |
220 | + <th><?php echo $formatter->asDecimal($sumDiscount, 2); ?></th> | |
221 | + </tr> | |
222 | + <tr class="total"> | |
223 | + <td><?php echo \Yii::t('app', 'ะัะพะณะพ ะบ ะพะฟะปะฐัะต'); ?></td> | |
224 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
225 | + </tr> | |
226 | + </tbody> | |
227 | + </table> | |
228 | + </div> | |
229 | + </div> | |
230 | + </div> | |
231 | + <!-- /.col-md-3 --> | |
232 | + | |
233 | + </div> | |
234 | + <!-- /.row --> | |
235 | + | |
236 | + </div> | |
237 | + <!-- /.container --> | |
238 | +</div> | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var \yii\web\View $this | |
4 | + * @var \artbox\order\models\Basket $basket | |
5 | + * @var \artbox\catalog\models\Variant[] $variants | |
6 | + */ | |
7 | + use artbox\core\helpers\ImageHelper; | |
8 | + use yii\bootstrap\Html; | |
9 | + | |
10 | + $formatter = \Yii::$app->formatter; | |
11 | + $sum = 0; | |
12 | + $sumDiscount = 0; | |
13 | + foreach ($variants as $variant) { | |
14 | + $count = $basket->getItem($variant->id)[ 'count' ]; | |
15 | + $sum += $variant->price * $count; | |
16 | + if (!empty($variant->price_old)) { | |
17 | + $sumDiscount += ( $variant->price_old - $variant->price ) * $count; | |
18 | + } | |
19 | + } | |
20 | +?> | |
21 | +<div id="content"> | |
22 | + <div class="container"> | |
23 | + <div class="row"> | |
24 | + <div id="basket" class="basket-container clearfix"> | |
25 | + <?php | |
26 | + if (!empty($variants)) { | |
27 | + ?> | |
28 | + <div class="col-md-9 clearfix"> | |
29 | + <h1><?php echo \Yii::t('app', 'ะะฐัะฐ ะบะพัะทะธะฝะฐ'); ?></h1> | |
30 | + | |
31 | + <div class="box"> | |
32 | + | |
33 | + <div class="table-responsive"> | |
34 | + <table class="table"> | |
35 | + <thead> | |
36 | + <tr> | |
37 | + <th colspan="2"><?php echo \Yii::t('app', 'ะัะพะดัะบั'); ?></th> | |
38 | + <th><?php echo \Yii::t('app', 'ะะพะปะธัะตััะฒะพ'); ?></th> | |
39 | + <th><?php echo \Yii::t('app', 'ะฆะตะฝะฐ ะทะฐ ะตะดะธะฝะธัั'); ?></th> | |
40 | + <th><?php echo \Yii::t('app', 'ะกะบะธะดะบะฐ'); ?></th> | |
41 | + <th colspan="2"><?php echo \Yii::t('app', 'ะัะตะณะพ'); ?></th> | |
42 | + </tr> | |
43 | + </thead> | |
44 | + <tbody> | |
45 | + <?php | |
46 | + foreach ($variants as $variant) { | |
47 | + $count = $basket->getItem($variant->id)[ 'count' ]; | |
48 | + ?> | |
49 | + <tr data-id="<?php echo $variant->id; ?>" class="product-row-basket"> | |
50 | + <td> | |
51 | + <?php | |
52 | + echo Html::a( | |
53 | + ImageHelper::set($variant->product->image->getPath()) | |
54 | + ->fillResize(50, 50) | |
55 | + ->renderImage( | |
56 | + [ | |
57 | + 'alt' => $variant->product->lang->title, | |
58 | + 'title' => $variant->product->lang->title, | |
59 | + ] | |
60 | + ), | |
61 | + [ | |
62 | + '/product/view', | |
63 | + 'id' => $variant->product->id, | |
64 | + ], | |
65 | + [ | |
66 | + 'target' => '_blank', | |
67 | + ] | |
68 | + ); | |
69 | + ?> | |
70 | + </td> | |
71 | + <td> | |
72 | + <?php | |
73 | + echo Html::a( | |
74 | + $variant->product->lang->title, | |
75 | + [ | |
76 | + '/product/view', | |
77 | + 'id' => $variant->product->id, | |
78 | + ], | |
79 | + [ | |
80 | + 'target' => '_blank', | |
81 | + ] | |
82 | + ); | |
83 | + ?> | |
84 | + </td> | |
85 | + <td> | |
86 | + <?php | |
87 | + echo Html::input( | |
88 | + 'number', | |
89 | + '', | |
90 | + $count, | |
91 | + [ | |
92 | + 'class' => 'form-control increase-product-basket', | |
93 | + ] | |
94 | + ); | |
95 | + ?> | |
96 | + </td> | |
97 | + <td> | |
98 | + <?php | |
99 | + echo $formatter->asDecimal($variant->price ? : 0, 2); | |
100 | + ?> | |
101 | + </td> | |
102 | + <td> | |
103 | + <?php | |
104 | + if (!empty($variant->price_old)) { | |
105 | + echo $formatter->asDecimal($variant->price_old - $variant->price, 2); | |
106 | + } else { | |
107 | + echo $formatter->asDecimal(0, 2); | |
108 | + } | |
109 | + ?> | |
110 | + </td> | |
111 | + <td> | |
112 | + <?php | |
113 | + echo $formatter->asDecimal( | |
114 | + ( $variant->price ? : 0 ) * $count, | |
115 | + 2 | |
116 | + ); | |
117 | + ?> | |
118 | + </td> | |
119 | + <td><a href="#" class="remove-product-cart"><i class="fa fa-trash-o"></i></a> | |
120 | + </td> | |
121 | + </tr> | |
122 | + <?php | |
123 | + } | |
124 | + ?> | |
125 | + </tbody> | |
126 | + <tfoot> | |
127 | + <tr> | |
128 | + <th colspan="5"><?php echo \Yii::t('app', 'ะัะตะณะพ'); ?></th> | |
129 | + <th colspan="2"><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
130 | + </tr> | |
131 | + </tfoot> | |
132 | + </table> | |
133 | + | |
134 | + </div> | |
135 | + <!-- /.table-responsive --> | |
136 | + | |
137 | + <div class="box-footer"> | |
138 | + <div class="pull-left"> | |
139 | + <?php | |
140 | + echo Html::a( | |
141 | + Html::icon('chevron-left', [ 'prefix' => 'fa fa-' ]) . \Yii::t( | |
142 | + 'app', | |
143 | + ' ะัะพะดะพะปะถะธัั ะฟะพะบัะฟะบะธ' | |
144 | + ), | |
145 | + [ 'site/index' ], | |
146 | + [ | |
147 | + 'class' => 'btn btn-default', | |
148 | + ] | |
149 | + ) | |
150 | + ?> | |
151 | + </div> | |
152 | + <div class="pull-right"> | |
153 | + <?php | |
154 | + echo Html::a( | |
155 | + \Yii::t( | |
156 | + 'app', | |
157 | + ' ะัะพัะผะธัั ะทะฐะบะฐะท ' | |
158 | + ) . Html::icon('chevron-right', [ 'prefix' => 'fa fa-' ]), | |
159 | + [ 'checkout/info' ], | |
160 | + [ | |
161 | + 'class' => 'btn btn-success', | |
162 | + ] | |
163 | + ) | |
164 | + ?> | |
165 | + </div> | |
166 | + </div> | |
167 | + | |
168 | + </div> | |
169 | + <!-- /.box --> | |
170 | + | |
171 | + </div> | |
172 | + <!-- /.col-md-9 --> | |
173 | + | |
174 | + <div class="col-md-3"> | |
175 | + <div class="box" id="order-summary"> | |
176 | + <div class="box-header"> | |
177 | + <h3>ะัะพะณะพะฒัะน ััะตั</h3> | |
178 | + </div> | |
179 | + <p class="text-muted small"><?php echo \Yii::t( | |
180 | + 'app', | |
181 | + 'ะกัะพะธะผะพััั ะดะพััะฐะฒะบะธ ัะฐัััะธััะฒะฐะตััั ะฒ ะทะฐะฒะธัะธะผะพััะธ ะพั ะฐะดัะตัะฐ ะธ ัะฟะพัะพะฑะฐ ะดะพััะฐะฒะบะธ' | |
182 | + ); ?></p> | |
183 | + | |
184 | + <div class="table-responsive"> | |
185 | + <table class="table"> | |
186 | + <tbody> | |
187 | + <tr> | |
188 | + <td><?php echo \Yii::t('app', 'ะัะตะณะพ ะทะฐ ัะพะฒะฐัั'); ?></td> | |
189 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
190 | + </tr> | |
191 | + <tr> | |
192 | + <td><?php echo \Yii::t('app', 'ะกัะผะผะฐ ัะบะธะดะบะธ'); ?></td> | |
193 | + <th><?php echo $formatter->asDecimal($sumDiscount, 2); ?></th> | |
194 | + </tr> | |
195 | + <tr class="total"> | |
196 | + <td><?php echo \Yii::t('app', 'ะัะพะณะพ ะบ ะพะฟะปะฐัะต'); ?></td> | |
197 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
198 | + </tr> | |
199 | + </tbody> | |
200 | + </table> | |
201 | + </div> | |
202 | + </div> | |
203 | + </div> | |
204 | + <!-- /.col-md-3 --> | |
205 | + <?php | |
206 | + } else { | |
207 | + echo Html::tag('p', \Yii::t('app', 'ะะฐัะฐ ะบะพัะทะธะฝะฐ ะฟัััะฐ!')); | |
208 | + } | |
209 | + ?> | |
210 | + </div> | |
211 | + <div class="col-md-12"> | |
212 | + <div class="heading text-center"> | |
213 | + <h2>ะกะผะพััะธัะต ัะฐะบะถะต</h2> | |
214 | + </div> | |
215 | + | |
216 | + <div class="product-carousel"> | |
217 | + <div class="homepage owl-carousel"> | |
218 | + <div class="products"> | |
219 | + <div class="col-md-3 col-sm-6"> | |
220 | + <div class="product"> | |
221 | + <div class="image"> | |
222 | + <a href="shop-detail.html"> | |
223 | + <img src="/img/product1.jpg" alt="" class="img-responsive image1"> | |
224 | + </a> | |
225 | + </div> | |
226 | + <!-- /.image --> | |
227 | + <div class="text"> | |
228 | + <h3><a href="shop-detail.html">Fur coat with very but very very long name</a></h3> | |
229 | + <p class="price">143.00</p> | |
230 | + <p class="buttons"> | |
231 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
232 | + </p> | |
233 | + </div> | |
234 | + <!-- /.text --> | |
235 | + | |
236 | + <div class="ribbon new"> | |
237 | + <div class="theribbon">ะะพะฒะพะต</div> | |
238 | + <div class="ribbon-background"></div> | |
239 | + </div> | |
240 | + <!-- /.ribbon --> | |
241 | + </div> | |
242 | + <!-- /.product --> | |
243 | + </div> | |
244 | + | |
245 | + <div class="col-md-3 col-sm-6"> | |
246 | + <div class="product"> | |
247 | + <div class="image"> | |
248 | + <a href="shop-detail.html"> | |
249 | + <img src="/img/product2.jpg" alt="" class="img-responsive image1"> | |
250 | + </a> | |
251 | + </div> | |
252 | + <!-- /.image --> | |
253 | + <div class="text"> | |
254 | + <h3><a href="shop-detail.html">White Blouse Armani</a></h3> | |
255 | + <p class="price"> | |
256 | + <del>280</del> | |
257 | + 143.00 | |
258 | + </p> | |
259 | + <p class="buttons"> | |
260 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
261 | + </p> | |
262 | + </div> | |
263 | + <!-- /.text --> | |
264 | + | |
265 | + <div class="ribbon sale"> | |
266 | + <div class="theribbon">ะะบัะธั</div> | |
267 | + <div class="ribbon-background"></div> | |
268 | + </div> | |
269 | + <!-- /.ribbon --> | |
270 | + | |
271 | + <div class="ribbon new"> | |
272 | + <div class="theribbon">ะะพะฒะพะต</div> | |
273 | + <div class="ribbon-background"></div> | |
274 | + </div> | |
275 | + <!-- /.ribbon --> | |
276 | + </div> | |
277 | + <!-- /.product --> | |
278 | + </div> | |
279 | + | |
280 | + <div class="col-md-3 col-sm-6"> | |
281 | + <div class="product"> | |
282 | + <div class="image"> | |
283 | + <a href="shop-detail.html"> | |
284 | + <img src="/img/product3.jpg" alt="" class="img-responsive image1"> | |
285 | + </a> | |
286 | + </div> | |
287 | + <!-- /.image --> | |
288 | + <div class="text"> | |
289 | + <h3><a href="shop-detail.html">Black Blouse Versace</a></h3> | |
290 | + <p class="price">143.00</p> | |
291 | + <p class="buttons"> | |
292 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
293 | + </p> | |
294 | + | |
295 | + </div> | |
296 | + <!-- /.text --> | |
297 | + | |
298 | + <div class="ribbon new"> | |
299 | + <div class="theribbon">ะะพะฒะพะต</div> | |
300 | + <div class="ribbon-background"></div> | |
301 | + </div> | |
302 | + <!-- /.ribbon --> | |
303 | + </div> | |
304 | + <!-- /.product --> | |
305 | + </div> | |
306 | + | |
307 | + <div class="col-md-3 col-sm-6"> | |
308 | + <div class="product"> | |
309 | + <div class="image"> | |
310 | + <a href="shop-detail.html"> | |
311 | + <img src="/img/product3.jpg" alt="" class="img-responsive image1"> | |
312 | + </a> | |
313 | + </div> | |
314 | + <!-- /.image --> | |
315 | + <div class="text"> | |
316 | + <h3><a href="shop-detail.html">Black Blouse Versace</a></h3> | |
317 | + <p class="price">143.00</p> | |
318 | + <p class="buttons"> | |
319 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
320 | + </p> | |
321 | + | |
322 | + </div> | |
323 | + <!-- /.text --> | |
324 | + | |
325 | + <div class="ribbon new"> | |
326 | + <div class="theribbon">ะะพะฒะพะต</div> | |
327 | + <div class="ribbon-background"></div> | |
328 | + </div> | |
329 | + <!-- /.ribbon --> | |
330 | + </div> | |
331 | + <!-- /.product --> | |
332 | + </div> | |
333 | + </div> | |
334 | + | |
335 | + <div class="products"> | |
336 | + <div class="col-md-3 col-sm-6"> | |
337 | + <div class="product"> | |
338 | + <div class="image"> | |
339 | + <a href="shop-detail.html"> | |
340 | + <img src="/img/product1.jpg" alt="" class="img-responsive image1"> | |
341 | + </a> | |
342 | + </div> | |
343 | + <!-- /.image --> | |
344 | + <div class="text"> | |
345 | + <h3><a href="shop-detail.html">Fur coat with very but very very long name</a></h3> | |
346 | + <p class="price">143.00</p> | |
347 | + <p class="buttons"> | |
348 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
349 | + </p> | |
350 | + </div> | |
351 | + <!-- /.text --> | |
352 | + | |
353 | + <div class="ribbon new"> | |
354 | + <div class="theribbon">ะะพะฒะพะต</div> | |
355 | + <div class="ribbon-background"></div> | |
356 | + </div> | |
357 | + <!-- /.ribbon --> | |
358 | + </div> | |
359 | + <!-- /.product --> | |
360 | + </div> | |
361 | + | |
362 | + <div class="col-md-3 col-sm-6"> | |
363 | + <div class="product"> | |
364 | + <div class="image"> | |
365 | + <a href="shop-detail.html"> | |
366 | + <img src="/img/product2.jpg" alt="" class="img-responsive image1"> | |
367 | + </a> | |
368 | + </div> | |
369 | + <!-- /.image --> | |
370 | + <div class="text"> | |
371 | + <h3><a href="shop-detail.html">White Blouse Armani</a></h3> | |
372 | + <p class="price"> | |
373 | + <del>280</del> | |
374 | + 143.00 | |
375 | + </p> | |
376 | + <p class="buttons"> | |
377 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
378 | + </p> | |
379 | + </div> | |
380 | + <!-- /.text --> | |
381 | + | |
382 | + <div class="ribbon sale"> | |
383 | + <div class="theribbon">ะะบัะธั</div> | |
384 | + <div class="ribbon-background"></div> | |
385 | + </div> | |
386 | + <!-- /.ribbon --> | |
387 | + | |
388 | + <div class="ribbon new"> | |
389 | + <div class="theribbon">ะะพะฒะพะต</div> | |
390 | + <div class="ribbon-background"></div> | |
391 | + </div> | |
392 | + <!-- /.ribbon --> | |
393 | + </div> | |
394 | + <!-- /.product --> | |
395 | + </div> | |
396 | + | |
397 | + <div class="col-md-3 col-sm-6"> | |
398 | + <div class="product"> | |
399 | + <div class="image"> | |
400 | + <a href="shop-detail.html"> | |
401 | + <img src="/img/product3.jpg" alt="" class="img-responsive image1"> | |
402 | + </a> | |
403 | + </div> | |
404 | + <!-- /.image --> | |
405 | + <div class="text"> | |
406 | + <h3><a href="shop-detail.html">Black Blouse Versace</a></h3> | |
407 | + <p class="price">143.00</p> | |
408 | + <p class="buttons"> | |
409 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
410 | + </p> | |
411 | + | |
412 | + </div> | |
413 | + <!-- /.text --> | |
414 | + | |
415 | + <div class="ribbon new"> | |
416 | + <div class="theribbon">ะะพะฒะพะต</div> | |
417 | + <div class="ribbon-background"></div> | |
418 | + </div> | |
419 | + <!-- /.ribbon --> | |
420 | + </div> | |
421 | + <!-- /.product --> | |
422 | + </div> | |
423 | + | |
424 | + <div class="col-md-3 col-sm-6"> | |
425 | + <div class="product"> | |
426 | + <div class="image"> | |
427 | + <a href="shop-detail.html"> | |
428 | + <img src="/img/product3.jpg" alt="" class="img-responsive image1"> | |
429 | + </a> | |
430 | + </div> | |
431 | + <!-- /.image --> | |
432 | + <div class="text"> | |
433 | + <h3><a href="shop-detail.html">Black Blouse Versace</a></h3> | |
434 | + <p class="price">143.00</p> | |
435 | + <p class="buttons"> | |
436 | + <a href="shop-basket.html" class="btn btn-template-main"><i class="fa fa-shopping-cart"></i>ะ ะบะพัะทะธะฝั</a> | |
437 | + </p> | |
438 | + | |
439 | + </div> | |
440 | + <!-- /.text --> | |
441 | + | |
442 | + <div class="ribbon new"> | |
443 | + <div class="theribbon">ะะพะฒะพะต</div> | |
444 | + <div class="ribbon-background"></div> | |
445 | + </div> | |
446 | + <!-- /.ribbon --> | |
447 | + </div> | |
448 | + <!-- /.product --> | |
449 | + </div> | |
450 | + </div> | |
451 | + </div> | |
452 | + </div> | |
453 | + </div> | |
454 | + </div> | |
455 | + </div> | |
456 | +</div> | |
0 | 457 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var \yii\web\View $this | |
4 | + * @var \frontend\models\Order $model | |
5 | + * @var \artbox\order\models\Basket $basket | |
6 | + */ | |
7 | + use yii\bootstrap\ActiveForm; | |
8 | + use yii\bootstrap\Html; | |
9 | + | |
10 | + $formatter = \Yii::$app->formatter; | |
11 | + $basket = \Yii::$app->get('basket'); | |
12 | + $sum = 0; | |
13 | + $sumDiscount = 0; | |
14 | + foreach ($basket->findModels(array_keys($basket->getData())) as $variant) { | |
15 | + $count = $basket->getItem($variant->id)[ 'count' ]; | |
16 | + $sum += $variant->price * $count; | |
17 | + if (!empty($variant->price_old)) { | |
18 | + $sumDiscount += ( $variant->price_old - $variant->price ) * $count; | |
19 | + } | |
20 | + } | |
21 | +?> | |
22 | +<div id="content"> | |
23 | + <div class="container"> | |
24 | + | |
25 | + <div class="row"> | |
26 | + | |
27 | + <div class="col-md-9 clearfix" id="checkout"> | |
28 | + | |
29 | + <div class="box"> | |
30 | + <?php | |
31 | + $form = ActiveForm::begin(); | |
32 | + ?> | |
33 | + | |
34 | + <ul class="nav nav-pills nav-justified"> | |
35 | + <?php | |
36 | + echo Html::tag( | |
37 | + 'li', | |
38 | + Html::a( | |
39 | + Html::icon( | |
40 | + 'map-marker', | |
41 | + [ | |
42 | + 'prefix' => 'fa fa-', | |
43 | + ] | |
44 | + ) . Html::tag('br') . \Yii::t('app', 'ะะดัะตั'), | |
45 | + '#' | |
46 | + ), | |
47 | + [ | |
48 | + 'class' => 'active', | |
49 | + ] | |
50 | + ); | |
51 | + echo Html::tag( | |
52 | + 'li', | |
53 | + Html::a( | |
54 | + Html::icon( | |
55 | + 'truck', | |
56 | + [ | |
57 | + 'prefix' => 'fa fa-', | |
58 | + ] | |
59 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะดะพััะฐะฒะบะธ'), | |
60 | + [ | |
61 | + 'checkout/delivery', | |
62 | + ] | |
63 | + ), | |
64 | + [ | |
65 | + 'class' => 'disabled', | |
66 | + ] | |
67 | + ); | |
68 | + echo Html::tag( | |
69 | + 'li', | |
70 | + Html::a( | |
71 | + Html::icon( | |
72 | + 'money', | |
73 | + [ | |
74 | + 'prefix' => 'fa fa-', | |
75 | + ] | |
76 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะพะฟะปะฐัั'), | |
77 | + [ | |
78 | + 'checkout/payment', | |
79 | + ] | |
80 | + ), | |
81 | + [ | |
82 | + 'class' => 'disabled', | |
83 | + ] | |
84 | + ); | |
85 | + echo Html::tag( | |
86 | + 'li', | |
87 | + Html::a( | |
88 | + Html::icon( | |
89 | + 'eye', | |
90 | + [ | |
91 | + 'prefix' => 'fa fa-', | |
92 | + ] | |
93 | + ) . Html::tag('br') . \Yii::t('app', 'ะัะพัะผะพัั ะทะฐะบะฐะทะฐ'), | |
94 | + [ | |
95 | + 'checkout/confirm', | |
96 | + ] | |
97 | + ), | |
98 | + [ | |
99 | + 'class' => 'disabled', | |
100 | + ] | |
101 | + ); | |
102 | + ?> | |
103 | + </ul> | |
104 | + | |
105 | + <div class="content"> | |
106 | + <?php | |
107 | + if (\Yii::$app->user->isGuest) { | |
108 | + ?> | |
109 | + <div class="box-header"> | |
110 | + <?php | |
111 | + echo \Yii::t('app', 'ะัะปะธ ะฒั ัะถะต ะทะฐัะตะณะธัััะธัะพะฒะฐะฝั ะฒ ะฝะฐัะตะผ ะผะฐะณะฐะทะธะฝะต'); | |
112 | + ?> | |
113 | + <a href="#" data-toggle="modal" data-target="#login-modal"><span>ะะพะนะดะธัะต ะฒ ัะฒะพะน ะฐะบะบะฐัะฝั</span> | |
114 | + <i class="fa fa-sign-in"></i></a> | |
115 | + </div> | |
116 | + <?php | |
117 | + } | |
118 | + ?> | |
119 | + <div class="row"> | |
120 | + <div class="col-sm-6"> | |
121 | + <?php | |
122 | + echo $form->field($model, 'name') | |
123 | + ->textInput(); | |
124 | + ?> | |
125 | + </div> | |
126 | + <div class="col-sm-6"></div> | |
127 | + </div> | |
128 | + <!-- /.row --> | |
129 | + | |
130 | + <div class="row"> | |
131 | + <div class="col-sm-6"> | |
132 | + <?php | |
133 | + echo $form->field($model, 'city') | |
134 | + ->textInput(); | |
135 | + ?> | |
136 | + </div> | |
137 | + <div class="col-sm-6"> | |
138 | + <?php | |
139 | + echo $form->field($model, 'address') | |
140 | + ->textInput(); | |
141 | + ?> | |
142 | + </div> | |
143 | + </div> | |
144 | + <!-- /.row --> | |
145 | + | |
146 | + <div class="row"> | |
147 | + <div class="col-sm-6"> | |
148 | + <?php | |
149 | + echo $form->field($model, 'phone') | |
150 | + ->textInput(); | |
151 | + ?> | |
152 | + </div> | |
153 | + <div class="col-sm-6"> | |
154 | + <?php | |
155 | + echo $form->field($model, 'email') | |
156 | + ->textInput(); | |
157 | + ?> | |
158 | + </div> | |
159 | + </div> | |
160 | + | |
161 | + <div class="row"> | |
162 | + <div class="col-xs-12"> | |
163 | + <?php | |
164 | + echo $form->field($model, 'comment') | |
165 | + ->textarea( | |
166 | + [ | |
167 | + 'rows' => 4, | |
168 | + ] | |
169 | + ); | |
170 | + ?> | |
171 | + </div> | |
172 | + </div> | |
173 | + <!-- /.row --> | |
174 | + </div> | |
175 | + | |
176 | + <div class="box-footer"> | |
177 | + <div class="pull-left"> | |
178 | + <?php | |
179 | + echo Html::a( | |
180 | + Html::icon( | |
181 | + 'chevron-left', | |
182 | + [ | |
183 | + 'prefix' => 'fa fa-', | |
184 | + ] | |
185 | + ) . \Yii::t('app', 'ะะฐะทะฐะด ะฒ ะบะพัะทะธะฝั'), | |
186 | + [ | |
187 | + 'checkout/index', | |
188 | + ], | |
189 | + [ | |
190 | + 'class' => 'btn btn-default', | |
191 | + ] | |
192 | + ); | |
193 | + ?> | |
194 | + </div> | |
195 | + <div class="pull-right"> | |
196 | + <?php | |
197 | + echo Html::submitButton( | |
198 | + \Yii::t('app', 'ะะตัะตะนัะธ ะบ ะฒัะฑะพัั ัะฟะพัะพะฑะฐ ะดะพััะฐะฒะบะธ') . Html::icon( | |
199 | + 'chevron-right', | |
200 | + [ | |
201 | + 'prefix' => 'fa fa-', | |
202 | + ] | |
203 | + ), | |
204 | + [ | |
205 | + 'class' => 'btn btn-success', | |
206 | + ] | |
207 | + ); | |
208 | + ?> | |
209 | + </div> | |
210 | + </div> | |
211 | + <?php | |
212 | + $form::end(); | |
213 | + ?> | |
214 | + </div> | |
215 | + <!-- /.box --> | |
216 | + | |
217 | + | |
218 | + </div> | |
219 | + <!-- /.col-md-9 --> | |
220 | + | |
221 | + <div class="col-md-3"> | |
222 | + <div class="box" id="order-summary"> | |
223 | + <div class="box-header"> | |
224 | + <h3>ะัะพะณะพะฒัะน ััะตั</h3> | |
225 | + </div> | |
226 | + <p class="text-muted small"><?php echo \Yii::t( | |
227 | + 'app', | |
228 | + 'ะกัะพะธะผะพััั ะดะพััะฐะฒะบะธ ัะฐัััะธััะฒะฐะตััั ะฒ ะทะฐะฒะธัะธะผะพััะธ ะพั ะฐะดัะตัะฐ ะธ ัะฟะพัะพะฑะฐ ะดะพััะฐะฒะบะธ' | |
229 | + ); ?></p> | |
230 | + | |
231 | + <div class="table-responsive"> | |
232 | + <table class="table"> | |
233 | + <tbody> | |
234 | + <tr> | |
235 | + <td><?php echo \Yii::t('app', 'ะัะตะณะพ ะทะฐ ัะพะฒะฐัั'); ?></td> | |
236 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
237 | + </tr> | |
238 | + <tr> | |
239 | + <td><?php echo \Yii::t('app', 'ะกัะผะผะฐ ัะบะธะดะบะธ'); ?></td> | |
240 | + <th><?php echo $formatter->asDecimal($sumDiscount, 2); ?></th> | |
241 | + </tr> | |
242 | + <tr class="total"> | |
243 | + <td><?php echo \Yii::t('app', 'ะัะพะณะพ ะบ ะพะฟะปะฐัะต'); ?></td> | |
244 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
245 | + </tr> | |
246 | + </tbody> | |
247 | + </table> | |
248 | + </div> | |
249 | + </div> | |
250 | + </div> | |
251 | + <!-- /.col-md-3 --> | |
252 | + | |
253 | + </div> | |
254 | + <!-- /.row --> | |
255 | + | |
256 | + </div> | |
257 | + <!-- /.container --> | |
258 | +</div> | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var \yii\web\View $this | |
4 | + * @var \frontend\models\Order $model | |
5 | + * @var \artbox\order\models\Payment[] $payments | |
6 | + * @var \artbox\order\models\Basket $basket | |
7 | + */ | |
8 | + use yii\bootstrap\ActiveForm; | |
9 | + use yii\bootstrap\Html; | |
10 | + | |
11 | + $formatter = \Yii::$app->formatter; | |
12 | + $basket = \Yii::$app->get('basket'); | |
13 | + $sum = 0; | |
14 | + $sumDiscount = 0; | |
15 | + foreach ($basket->findModels(array_keys($basket->getData())) as $variant) { | |
16 | + $count = $basket->getItem($variant->id)[ 'count' ]; | |
17 | + $sum += $variant->price * $count; | |
18 | + if (!empty($variant->price_old)) { | |
19 | + $sumDiscount += ( $variant->price_old - $variant->price ) * $count; | |
20 | + } | |
21 | + } | |
22 | +?> | |
23 | +<div id="content"> | |
24 | + <div class="container"> | |
25 | + | |
26 | + <div class="row"> | |
27 | + | |
28 | + <div class="col-md-9 clearfix" id="checkout"> | |
29 | + | |
30 | + <div class="box"> | |
31 | + <?php | |
32 | + $form = ActiveForm::begin(); | |
33 | + ?> | |
34 | + <ul class="nav nav-pills nav-justified"> | |
35 | + <?php | |
36 | + echo Html::tag( | |
37 | + 'li', | |
38 | + Html::a( | |
39 | + Html::icon( | |
40 | + 'map-marker', | |
41 | + [ | |
42 | + 'prefix' => 'fa fa-', | |
43 | + ] | |
44 | + ) . Html::tag('br') . \Yii::t('app', 'ะะดัะตั'), | |
45 | + [ 'checkout/info' ] | |
46 | + ) | |
47 | + ); | |
48 | + echo Html::tag( | |
49 | + 'li', | |
50 | + Html::a( | |
51 | + Html::icon( | |
52 | + 'truck', | |
53 | + [ | |
54 | + 'prefix' => 'fa fa-', | |
55 | + ] | |
56 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะดะพััะฐะฒะบะธ'), | |
57 | + [ 'checkout/delivery' ] | |
58 | + ) | |
59 | + ); | |
60 | + echo Html::tag( | |
61 | + 'li', | |
62 | + Html::a( | |
63 | + Html::icon( | |
64 | + 'money', | |
65 | + [ | |
66 | + 'prefix' => 'fa fa-', | |
67 | + ] | |
68 | + ) . Html::tag('br') . \Yii::t('app', 'ะกะฟะพัะพะฑ ะพะฟะปะฐัั'), | |
69 | + [ | |
70 | + '#', | |
71 | + ] | |
72 | + ), | |
73 | + [ | |
74 | + 'class' => 'active', | |
75 | + ] | |
76 | + ); | |
77 | + echo Html::tag( | |
78 | + 'li', | |
79 | + Html::a( | |
80 | + Html::icon( | |
81 | + 'eye', | |
82 | + [ | |
83 | + 'prefix' => 'fa fa-', | |
84 | + ] | |
85 | + ) . Html::tag('br') . \Yii::t('app', 'ะัะพัะผะพัั ะทะฐะบะฐะทะฐ'), | |
86 | + [ | |
87 | + 'checkout/confirm', | |
88 | + ] | |
89 | + ), | |
90 | + [ | |
91 | + 'class' => 'disabled', | |
92 | + ] | |
93 | + ); | |
94 | + ?> | |
95 | + </ul> | |
96 | + | |
97 | + | |
98 | + <div class="content"> | |
99 | + <div class="row"> | |
100 | + <?php | |
101 | + if ($model->hasErrors()) { | |
102 | + echo Html::tag( | |
103 | + 'p', | |
104 | + \Yii::t('app', 'Please choose payment method.'), | |
105 | + [ | |
106 | + 'class' => 'text-danger', | |
107 | + ] | |
108 | + ); | |
109 | + } | |
110 | + foreach ($payments as $index => $payment) { | |
111 | + ?> | |
112 | + <div class="col-sm-4"> | |
113 | + <div class="box shipping-method"> | |
114 | + | |
115 | + <div class="box-header text-center"> | |
116 | + <?php | |
117 | + echo $form->field( | |
118 | + $model, | |
119 | + 'payment_id', | |
120 | + [ | |
121 | + 'options' => [ | |
122 | + 'class' => 'form-group order-radio', | |
123 | + ], | |
124 | + ] | |
125 | + ) | |
126 | + ->radio( | |
127 | + [ | |
128 | + 'uncheck' => ( $index === 0 ) ? 0 : null, | |
129 | + 'label' => null, | |
130 | + 'tag' => false, | |
131 | + 'value' => $payment->id, | |
132 | + ] | |
133 | + ) | |
134 | + ->label(false) | |
135 | + ->error(false); | |
136 | + ?> | |
137 | + <h4><?php echo $payment->lang->title; ?></h4> | |
138 | + </div> | |
139 | + | |
140 | + <p><?php echo $payment->lang->description; ?></p> | |
141 | + | |
142 | + </div> | |
143 | + </div> | |
144 | + <?php | |
145 | + } | |
146 | + ?> | |
147 | + </div> | |
148 | + <!-- /.row --> | |
149 | + | |
150 | + </div> | |
151 | + <!-- /.content --> | |
152 | + | |
153 | + <div class="box-footer"> | |
154 | + <div class="pull-left"> | |
155 | + <?php | |
156 | + echo Html::a( | |
157 | + Html::icon( | |
158 | + 'chevron-left', | |
159 | + [ | |
160 | + 'prefix' => 'fa fa-', | |
161 | + ] | |
162 | + ) . \Yii::t('app', 'ะะพััะฐะฒะบะฐ'), | |
163 | + [ | |
164 | + 'checkout/delivery', | |
165 | + ], | |
166 | + [ | |
167 | + 'class' => 'btn btn-default', | |
168 | + ] | |
169 | + ); | |
170 | + ?> | |
171 | + </div> | |
172 | + <div class="pull-right"> | |
173 | + <?php | |
174 | + echo Html::submitButton( | |
175 | + \Yii::t('app', 'ะะตัะตะนัะธ ะบ ะฟัะพัะผะพััั ะทะฐะบะฐะทะฐ') . Html::icon( | |
176 | + 'chevron-right', | |
177 | + [ | |
178 | + 'prefix' => 'fa fa-', | |
179 | + ] | |
180 | + ), | |
181 | + [ | |
182 | + 'class' => 'btn btn-success', | |
183 | + ] | |
184 | + ); | |
185 | + ?> | |
186 | + </div> | |
187 | + </div> | |
188 | + <?php | |
189 | + $form::end(); | |
190 | + ?> | |
191 | + </div> | |
192 | + <!-- /.box --> | |
193 | + | |
194 | + | |
195 | + </div> | |
196 | + <!-- /.col-md-9 --> | |
197 | + | |
198 | + <div class="col-md-3"> | |
199 | + <div class="box" id="order-summary"> | |
200 | + <div class="box-header"> | |
201 | + <h3>ะัะพะณะพะฒัะน ััะตั</h3> | |
202 | + </div> | |
203 | + <p class="text-muted small"><?php echo \Yii::t( | |
204 | + 'app', | |
205 | + 'ะกัะพะธะผะพััั ะดะพััะฐะฒะบะธ ัะฐัััะธััะฒะฐะตััั ะฒ ะทะฐะฒะธัะธะผะพััะธ ะพั ะฐะดัะตัะฐ ะธ ัะฟะพัะพะฑะฐ ะดะพััะฐะฒะบะธ' | |
206 | + ); ?></p> | |
207 | + | |
208 | + <div class="table-responsive"> | |
209 | + <table class="table"> | |
210 | + <tbody> | |
211 | + <tr> | |
212 | + <td><?php echo \Yii::t('app', 'ะัะตะณะพ ะทะฐ ัะพะฒะฐัั'); ?></td> | |
213 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
214 | + </tr> | |
215 | + <tr> | |
216 | + <td><?php echo \Yii::t('app', 'ะกัะผะผะฐ ัะบะธะดะบะธ'); ?></td> | |
217 | + <th><?php echo $formatter->asDecimal($sumDiscount, 2); ?></th> | |
218 | + </tr> | |
219 | + <tr class="total"> | |
220 | + <td><?php echo \Yii::t('app', 'ะัะพะณะพ ะบ ะพะฟะปะฐัะต'); ?></td> | |
221 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | |
222 | + </tr> | |
223 | + </tbody> | |
224 | + </table> | |
225 | + </div> | |
226 | + </div> | |
227 | + </div> | |
228 | + <!-- /.col-md-3 --> | |
229 | + | |
230 | + </div> | |
231 | + <!-- /.row --> | |
232 | + | |
233 | + </div> | |
234 | + <!-- /.container --> | |
235 | +</div> | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -23,6 +23,9 @@ |
23 | 23 | use yii\widgets\Breadcrumbs; |
24 | 24 | |
25 | 25 | AppAsset::register($this); |
26 | + /** | |
27 | + * @var \artbox\order\models\Customer $user | |
28 | + */ | |
26 | 29 | $user = \Yii::$app->user->identity; |
27 | 30 | $seo = Yii::$app->get('seo'); |
28 | 31 | $feedback = new Feedback(); |
... | ... | @@ -140,8 +143,16 @@ _________________________________________________________ --> |
140 | 143 | </a> |
141 | 144 | </div> |
142 | 145 | <div class="inline-block login"> |
143 | - <a href="#" data-toggle="modal" data-target="#login-modal"><i class="fa fa-sign-in"></i> | |
144 | - <span>ะั ะพะด</span></a> | |
146 | + <?php | |
147 | + if (\Yii::$app->user->isGuest) { | |
148 | + ?> | |
149 | + <a href="#" data-toggle="modal" data-target="#login-modal"><i class="fa fa-sign-in"></i> | |
150 | + <span>ะั ะพะด</span></a> | |
151 | + <?php | |
152 | + } else { | |
153 | + echo Html::a($user->username, [ 'account/index' ]); | |
154 | + } | |
155 | + ?> | |
145 | 156 | </div> |
146 | 157 | </div> |
147 | 158 | </div> |
... | ... | @@ -240,7 +251,7 @@ _________________________________________________________ --> |
240 | 251 | <!--/.nav-collapse --> |
241 | 252 | |
242 | 253 | <div class="cart-item" id="cart"> |
243 | - <span class="badge">0</span> | |
254 | + <span class="badge">0</span> | |
244 | 255 | <?php |
245 | 256 | echo Html::a( |
246 | 257 | Html::tag( |
... | ... | @@ -251,7 +262,7 @@ _________________________________________________________ --> |
251 | 262 | ] |
252 | 263 | ), |
253 | 264 | [ |
254 | - '/basket/index', | |
265 | + '/checkout/index', | |
255 | 266 | ], |
256 | 267 | [ |
257 | 268 | 'class' => 'cart-item-link', |
... | ... | @@ -332,64 +343,75 @@ _________________________________________________________ --> |
332 | 343 | |
333 | 344 | <!-- *** LOGIN MODAL *** |
334 | 345 | _________________________________________________________ --> |
335 | - | |
336 | - <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true"> | |
337 | - <div class="modal-dialog modal-sm"> | |
338 | - | |
339 | - <div class="modal-content"> | |
340 | - <div class="modal-header"> | |
341 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
342 | - <h4 class="modal-title" id="Login"> | |
343 | - <?php echo \Yii::t('app', 'Customer login'); ?> | |
344 | - </h4> | |
345 | - </div> | |
346 | - <div class="modal-body"> | |
347 | - <?php | |
348 | - $login = ActiveForm::begin( | |
349 | - [ | |
350 | - 'action' => [ '/site/login' ], | |
351 | - ] | |
352 | - ); | |
353 | - echo $login->field($loginForm, 'returnUrl') | |
354 | - ->label(false) | |
355 | - ->hiddenInput(); | |
356 | - echo $login->field($loginForm, 'username') | |
357 | - ->label(false) | |
358 | - ->textInput( | |
359 | - [ | |
360 | - 'placeholder' => $loginForm->getAttributeLabel('username'), | |
361 | - ] | |
362 | - ); | |
363 | - echo $login->field($loginForm, 'username') | |
364 | - ->label(false) | |
365 | - ->passwordInput( | |
366 | - [ | |
367 | - 'placeholder' => $loginForm->getAttributeLabel('password'), | |
368 | - ] | |
369 | - ); | |
370 | - $login::end(); | |
346 | + <?php | |
347 | + if (\Yii::$app->user->isGuest) { | |
371 | 348 | ?> |
372 | - <p class="text-center text-muted"> | |
373 | - <?php echo \Yii::t('app', 'Not registered yet?'); ?></p> | |
374 | - <p class="text-center text-muted"> | |
375 | - <?php | |
376 | - echo Html::a( | |
377 | - Html::tag('strong', \Yii::t('app', 'Register now! ')), | |
378 | - [ | |
379 | - '/site/signup', | |
380 | - ] | |
381 | - ); | |
382 | - echo \Yii::t( | |
383 | - 'app', | |
384 | - 'It is easy and done in 1 minute and gives you access to special discounts and much more!' | |
385 | - ); | |
386 | - ?> | |
387 | - </p> | |
349 | + <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true"> | |
350 | + <div class="modal-dialog modal-sm"> | |
388 | 351 | |
389 | - </div> | |
390 | - </div> | |
391 | - </div> | |
392 | - </div> | |
352 | + <div class="modal-content"> | |
353 | + <div class="modal-header"> | |
354 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
355 | + <h4 class="modal-title" id="Login"> | |
356 | + <?php echo \Yii::t('app', 'Customer login'); ?> | |
357 | + </h4> | |
358 | + </div> | |
359 | + <div class="modal-body"> | |
360 | + <?php | |
361 | + $login = ActiveForm::begin( | |
362 | + [ | |
363 | + 'action' => [ '/site/login' ], | |
364 | + ] | |
365 | + ); | |
366 | + echo $login->field($loginForm, 'returnUrl') | |
367 | + ->label(false) | |
368 | + ->hiddenInput(); | |
369 | + echo $login->field($loginForm, 'username') | |
370 | + ->label(false) | |
371 | + ->textInput( | |
372 | + [ | |
373 | + 'placeholder' => $loginForm->getAttributeLabel('username'), | |
374 | + ] | |
375 | + ); | |
376 | + echo $login->field($loginForm, 'password') | |
377 | + ->label(false) | |
378 | + ->passwordInput( | |
379 | + [ | |
380 | + 'placeholder' => $loginForm->getAttributeLabel('password'), | |
381 | + ] | |
382 | + ); | |
383 | + echo Html::submitButton( | |
384 | + \Yii::t('app', 'Login'), | |
385 | + [ | |
386 | + 'class' => 'btn btn-success', | |
387 | + ] | |
388 | + ); | |
389 | + $login::end(); | |
390 | + ?> | |
391 | + <p class="text-center text-muted"> | |
392 | + <?php echo \Yii::t('app', 'Not registered yet?'); ?></p> | |
393 | + <p class="text-center text-muted"> | |
394 | + <?php | |
395 | + echo Html::a( | |
396 | + Html::tag('strong', \Yii::t('app', 'Register now! ')), | |
397 | + [ | |
398 | + '/site/login', | |
399 | + ] | |
400 | + ); | |
401 | + echo \Yii::t( | |
402 | + 'app', | |
403 | + 'It is easy and done in 1 minute and gives you access to special discounts and much more!' | |
404 | + ); | |
405 | + ?> | |
406 | + </p> | |
407 | + | |
408 | + </div> | |
409 | + </div> | |
410 | + </div> | |
411 | + </div> | |
412 | + <?php | |
413 | + } | |
414 | + ?> | |
393 | 415 | |
394 | 416 | <!-- *** LOGIN MODAL END *** --> |
395 | 417 | ... | ... |
frontend/views/product/view.php
... | ... | @@ -171,21 +171,54 @@ |
171 | 171 | <p class="no-margin"><?php echo $variant->sku; ?></p> |
172 | 172 | <p class="price"> |
173 | 173 | <span class="price-title">ะฆะตะฝะฐ:</span><?php echo $variant->price ? : 0; ?> ะณัะฝ  |
174 | - <button class="btn btn-success"> | |
175 | - <i class="fa fa-shopping-cart"></i> ะะพะฑะฐะฒะธัั ะฒ ะบะพัะทะธะฝั | |
176 | - </button> | |
177 | - <button class="btn btn-default pull-right" data-toggle="tooltip" data-placement="top" title="ะะพะฑะฐะฒะธัั ะฒ ะธะทะฑัะฐะฝะฝะพะต"> | |
178 | - <i class="fa fa-heart-o"></i> | |
179 | - </button> | |
174 | + <?php | |
175 | + if ($variant->stock && $variant->price) { | |
176 | + echo Html::a( | |
177 | + Html::tag( | |
178 | + 'i', | |
179 | + '', | |
180 | + [ | |
181 | + 'class' => 'fa fa-shopping-cart', | |
182 | + ] | |
183 | + ) . \Yii::t('app', 'ะะพะฑะฐะฒะธัั ะฒ ะบะพัะทะธะฝั'), | |
184 | + '#', | |
185 | + [ | |
186 | + 'class' => 'btn btn-success add-to-basket', | |
187 | + 'data-id' => $variant->id, | |
188 | + ] | |
189 | + ); | |
190 | + } else { | |
191 | + echo Html::a( | |
192 | + \Yii::t('app', 'ะะตั ะฒ ะฝะฐะปะธัะธะธ'), | |
193 | + '#', | |
194 | + [ | |
195 | + 'class' => 'btn btn-info disabled', | |
196 | + 'data-id' => $variant->id, | |
197 | + ] | |
198 | + ); | |
199 | + } | |
200 | + ?> | |
201 | + <?php | |
202 | + /* | |
203 | + ?> | |
204 | + <button class="btn btn-default pull-right" data-toggle="tooltip" data-placement="top" title="ะะพะฑะฐะฒะธัั ะฒ ะธะทะฑัะฐะฝะฝะพะต"> | |
205 | + <i class="fa fa-heart-o"></i> | |
206 | + </button> | |
207 | + */ | |
208 | + ?> | |
180 | 209 | </p> |
181 | 210 | <hr> |
182 | - | |
183 | - <button class="btn btn-template-main"> | |
184 | - <i class="fa fa-phone"></i> ะัะฟะธัั ะฒ ะพะดะธะฝ ะบะปะธะบ | |
185 | - </button> | |
186 | -  <button class="btn btn-template-main"> | |
187 | - <i class="fa fa-tags"></i> ะัะฟะธัั ะฒ ะบัะตะดะธั | |
188 | - </button> | |
211 | + <?php | |
212 | + /* | |
213 | + ?> | |
214 | + <button class="btn btn-template-main"> | |
215 | + <i class="fa fa-phone"></i> ะัะฟะธัั ะฒ ะพะดะธะฝ ะบะปะธะบ | |
216 | + </button> | |
217 | +  <button class="btn btn-template-main"> | |
218 | + <i class="fa fa-tags"></i> ะัะฟะธัั ะฒ ะบัะตะดะธั | |
219 | + </button> | |
220 | + */ | |
221 | + ?> | |
189 | 222 | </div> |
190 | 223 | <div class="box" id="details"> |
191 | 224 | <h2><?php echo \Yii::t('app', 'ะะฟะธัะฐะฝะธะต ัะพะฒะฐัะฐ'); ?></h2> | ... | ... |
frontend/views/site/_slider_product.php
... | ... | @@ -5,89 +5,103 @@ |
5 | 5 | use yii\web\View; |
6 | 6 | |
7 | 7 | /** |
8 | - * @var View $this | |
9 | - * @var Product $product | |
8 | + * @var View $this | |
9 | + * @var Product $product | |
10 | 10 | */ |
11 | 11 | ?> |
12 | 12 | <div class="col-md-3 col-sm-6"> |
13 | - <div class="product"> | |
14 | - <div class="image"> | |
15 | - <?php | |
16 | - echo Html::a( | |
17 | - Html::img( | |
18 | - ImageHelper::set( | |
19 | - $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png' | |
20 | - ) | |
21 | - ->fillResize(260, 260) | |
22 | - ->render(), | |
23 | - [ | |
24 | - 'class' => 'img-responsive-image1', | |
25 | - ] | |
26 | - ), | |
13 | + <div class="product"> | |
14 | + <div class="image"> | |
15 | + <?php | |
16 | + echo Html::a( | |
17 | + Html::img( | |
18 | + ImageHelper::set( | |
19 | + $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png' | |
20 | + ) | |
21 | + ->fillResize(260, 260) | |
22 | + ->render(), | |
27 | 23 | [ |
28 | - 'product/view', | |
29 | - 'id' => $product->id, | |
24 | + 'class' => 'img-responsive-image1', | |
30 | 25 | ] |
31 | - ); | |
32 | - ?> | |
33 | - </div> | |
34 | - <!-- /.image --> | |
35 | - <div class="text"> | |
36 | - <h3> | |
37 | - <?php | |
38 | - echo Html::a( | |
39 | - $product->lang->title, | |
40 | - [ | |
41 | - 'product/view', | |
42 | - 'id' => $product->id, | |
43 | - ] | |
44 | - ); | |
45 | - ?> | |
46 | - </h3> | |
47 | - <p class="price"> | |
48 | - <?php | |
49 | - if ($product->variants[ 0 ]->price_old) { | |
50 | - echo Html::tag('del', $product->variants[ 0 ]->price_old . ' ะณัะฝ.'); | |
51 | - } | |
52 | - echo $product->variants[ 0 ]->price ? : 0 . ' ะณัะฝ.'; | |
53 | - ?></p> | |
54 | - <p class="buttons"> | |
55 | - <?php | |
56 | - echo Html::a( | |
57 | - Html::tag( | |
58 | - 'i', | |
59 | - '', | |
60 | - [ | |
61 | - 'class' => 'fa fa-shopping-cart', | |
62 | - ] | |
63 | - ) . \Yii::t('app', 'ะ ะบะพัะทะธะฝั'), | |
64 | - '#', | |
65 | - [ 'class' => 'btn btn-template-main' ] | |
66 | - ); | |
67 | - ?> | |
68 | - </p> | |
69 | - </div> | |
70 | - <!-- /.text --> | |
71 | - <?php | |
72 | - if ($product->is('new')) { | |
73 | - ?> | |
74 | - <div class="ribbon new"> | |
75 | - <div class="theribbon"><?php echo \Yii::t('app', 'ะะพะฒะพะต'); ?></div> | |
76 | - <div class="ribbon-background"></div> | |
77 | - </div> | |
78 | - <?php | |
79 | - } | |
80 | - if ($product->is('akcia')) { | |
81 | - ?> | |
82 | - <div class="ribbon sale"> | |
83 | - <div class="theribbon"><?php echo \Yii::t('app', 'ะะบัะธั'); ?></div> | |
84 | - <div class="ribbon-background"></div> | |
85 | - </div> | |
86 | - <?php | |
87 | - } | |
26 | + ), | |
27 | + [ | |
28 | + 'product/view', | |
29 | + 'id' => $product->id, | |
30 | + ] | |
31 | + ); | |
88 | 32 | ?> |
89 | - | |
90 | - <!-- /.ribbon --> | |
91 | 33 | </div> |
92 | - <!-- /.product --> | |
34 | + <!-- /.image --> | |
35 | + <div class="text"> | |
36 | + <h3> | |
37 | + <?php | |
38 | + echo Html::a( | |
39 | + $product->lang->title, | |
40 | + [ | |
41 | + 'product/view', | |
42 | + 'id' => $product->id, | |
43 | + ] | |
44 | + ); | |
45 | + ?> | |
46 | + </h3> | |
47 | + <p class="price"> | |
48 | + <?php | |
49 | + if ($product->variants[ 0 ]->price_old) { | |
50 | + echo Html::tag('del', $product->variants[ 0 ]->price_old . ' ะณัะฝ.'); | |
51 | + } | |
52 | + echo ( $product->variants[ 0 ]->price ? : 0 ) . ' ะณัะฝ.'; | |
53 | + ?></p> | |
54 | + <p class="buttons"> | |
55 | + <?php | |
56 | + if ($product->variants[ 0 ]->stock && $product->variants[ 0 ]->price) { | |
57 | + echo Html::a( | |
58 | + Html::tag( | |
59 | + 'i', | |
60 | + '', | |
61 | + [ | |
62 | + 'class' => 'fa fa-shopping-cart', | |
63 | + ] | |
64 | + ) . \Yii::t('app', 'ะ ะบะพัะทะธะฝั'), | |
65 | + '#', | |
66 | + [ | |
67 | + 'class' => 'btn btn-template-main add-to-basket', | |
68 | + 'data-id' => $product->variants[ 0 ]->id, | |
69 | + ] | |
70 | + ); | |
71 | + } else { | |
72 | + echo Html::a( | |
73 | + \Yii::t('app', 'ะะตั ะฒ ะฝะฐะปะธัะธะธ'), | |
74 | + '#', | |
75 | + [ | |
76 | + 'class' => 'btn btn-info disabled', | |
77 | + 'data-id' => $product->variants[ 0 ]->id, | |
78 | + ] | |
79 | + ); | |
80 | + } | |
81 | + ?> | |
82 | + </p> | |
83 | + </div> | |
84 | + <!-- /.text --> | |
85 | + <?php | |
86 | + if ($product->is('new')) { | |
87 | + ?> | |
88 | + <div class="ribbon new"> | |
89 | + <div class="theribbon"><?php echo \Yii::t('app', 'ะะพะฒะพะต'); ?></div> | |
90 | + <div class="ribbon-background"></div> | |
91 | + </div> | |
92 | + <?php | |
93 | + } | |
94 | + if ($product->is('akcia')) { | |
95 | + ?> | |
96 | + <div class="ribbon sale"> | |
97 | + <div class="theribbon"><?php echo \Yii::t('app', 'ะะบัะธั'); ?></div> | |
98 | + <div class="ribbon-background"></div> | |
99 | + </div> | |
100 | + <?php | |
101 | + } | |
102 | + ?> | |
103 | + | |
104 | + <!-- /.ribbon --> | |
105 | + </div> | |
106 | + <!-- /.product --> | |
93 | 107 | </div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | + /* @var $this yii\web\View */ | |
4 | + /* @var $form yii\bootstrap\ActiveForm */ | |
5 | + /* @var $loginForm \common\models\LoginForm */ | |
6 | + /* @var $signupForm \common\models\SignupForm */ | |
7 | + | |
8 | + use yii\bootstrap\ActiveForm; | |
9 | + use yii\bootstrap\Html; | |
10 | + | |
11 | + $this->title = \Yii::t('app', 'ะะพะฒัะน ะฐะบะบะฐัะฝั / ะ ะตะณะธัััะฐัะธั'); | |
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
13 | +?> | |
14 | +<div id="content"> | |
15 | + <div class="container"> | |
16 | + | |
17 | + <div class="row"> | |
18 | + <div class="col-md-6"> | |
19 | + <div class="box"> | |
20 | + <h2 class="text-uppercase"><?php echo \Yii::t('app', 'ะะพะฒัะน ะฐะบะบะฐัะฝั'); ?></h2> | |
21 | + | |
22 | + <p class="lead"><?php echo \Yii::t('app', 'ะะต ะทะฐัะตะณะธัััะธัะพะฒะฐะฝั?'); ?></p> | |
23 | + <p class="text-muted"><?php echo \Yii::t( | |
24 | + 'app', | |
25 | + 'ะัะปะธ ั ะฒะฐั ะตััั ะฒะพะฟัะพัั, ะฟะพะถะฐะปัะนััะฐ, {link}, ะฝะฐั ัะตะฝัั ะพะฑัะปัะถะธะฒะฐะฝะธั ะบะปะธะตะฝัะพะฒ ัะฐะฑะพัะฐะตั ะบััะณะปะพัััะพัะฝะพ.', | |
26 | + [ | |
27 | + 'link' => Html::a( | |
28 | + \Yii::t('app', 'ะฝะฐะฟะธัะธัะต ะฝะฐะผ'), | |
29 | + [ | |
30 | + 'page/view', | |
31 | + 'id' => 17, | |
32 | + ] | |
33 | + ), | |
34 | + ] | |
35 | + ); ?></p> | |
36 | + | |
37 | + <hr> | |
38 | + | |
39 | + <?php | |
40 | + $formSignup = ActiveForm::begin(); | |
41 | + echo $formSignup->field($signupForm, 'username') | |
42 | + ->textInput(); | |
43 | + echo $formSignup->field($signupForm, 'email') | |
44 | + ->textInput(); | |
45 | + echo $formSignup->field($signupForm, 'password') | |
46 | + ->passwordInput(); | |
47 | + echo Html::tag( | |
48 | + 'div', | |
49 | + Html::submitButton( | |
50 | + Html::icon( | |
51 | + 'user-md', | |
52 | + [ | |
53 | + 'prefix' => 'fa fa-', | |
54 | + ] | |
55 | + ) . \Yii::t('app', 'Register'), | |
56 | + [ | |
57 | + 'class' => 'btn btn-template-main', | |
58 | + ] | |
59 | + ), | |
60 | + [ | |
61 | + 'class' => 'text-center', | |
62 | + ] | |
63 | + ); | |
64 | + $formSignup::end(); | |
65 | + ?> | |
66 | + </div> | |
67 | + </div> | |
68 | + | |
69 | + <div class="col-md-6"> | |
70 | + <div class="box"> | |
71 | + <h2 class="text-uppercase"><?php echo \Yii::t('app', 'ะะพะนัะธ'); ?></h2> | |
72 | + | |
73 | + <p class="lead"><?php echo \Yii::t('app', 'ะฃะถะต ะทะฐัะตะณะธัััะธัะพะฒะฐะฝั?'); ?></p> | |
74 | + | |
75 | + <hr> | |
76 | + | |
77 | + <?php | |
78 | + $formLogin = ActiveForm::begin(); | |
79 | + echo $formLogin->field($loginForm, 'username') | |
80 | + ->textInput(); | |
81 | + echo $formLogin->field($loginForm, 'password') | |
82 | + ->passwordInput(); | |
83 | + echo $formLogin->field($loginForm, 'rememberMe') | |
84 | + ->checkbox(); | |
85 | + echo Html::tag( | |
86 | + 'div', | |
87 | + Html::submitButton( | |
88 | + Html::icon( | |
89 | + 'sign-in', | |
90 | + [ | |
91 | + 'prefix' => 'fa fa-', | |
92 | + ] | |
93 | + ) . \Yii::t('app', 'Login'), | |
94 | + [ | |
95 | + 'class' => 'btn btn-template-main', | |
96 | + ] | |
97 | + ), | |
98 | + [ | |
99 | + 'class' => 'text-center', | |
100 | + ] | |
101 | + ); | |
102 | + $formSignup::end(); | |
103 | + ?> | |
104 | + </div> | |
105 | + </div> | |
106 | + | |
107 | + </div> | |
108 | + <!-- /.row --> | |
109 | + | |
110 | + </div> | |
111 | + <!-- /.container --> | |
112 | +</div> | |
0 | 113 | \ No newline at end of file | ... | ... |
frontend/views/site/requestPasswordResetToken.php
0 โ 100644
1 | +<?php | |
2 | + | |
3 | + /* @var $this yii\web\View */ | |
4 | + /* @var $form yii\bootstrap\ActiveForm */ | |
5 | + /* @var $model PasswordResetRequestForm */ | |
6 | + | |
7 | + use common\models\PasswordResetRequestForm; | |
8 | + use yii\helpers\Html; | |
9 | + use yii\bootstrap\ActiveForm; | |
10 | + | |
11 | + $this->title = 'Request password reset'; | |
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
13 | +?> | |
14 | +<div class="site-request-password-reset"> | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p>Please fill out your email. A link to reset password will be sent there.</p> | |
18 | + | |
19 | + <div class="row"> | |
20 | + <div class="col-lg-5"> | |
21 | + <?php $form = ActiveForm::begin([ 'id' => 'request-password-reset-form' ]); ?> | |
22 | + | |
23 | + <?= $form->field($model, 'email') | |
24 | + ->textInput([ 'autofocus' => true ]) ?> | |
25 | + | |
26 | + <div class="form-group"> | |
27 | + <?= Html::submitButton('Send', [ 'class' => 'btn btn-primary' ]) ?> | |
28 | + </div> | |
29 | + | |
30 | + <?php ActiveForm::end(); ?> | |
31 | + </div> | |
32 | + </div> | |
33 | +</div> | |
0 | 34 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + | |
3 | + /* @var $this yii\web\View */ | |
4 | + /* @var $form yii\bootstrap\ActiveForm */ | |
5 | + /* @var $model ResetPasswordForm */ | |
6 | + | |
7 | + use common\models\ResetPasswordForm; | |
8 | + use yii\helpers\Html; | |
9 | + use yii\bootstrap\ActiveForm; | |
10 | + | |
11 | + $this->title = 'Reset password'; | |
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
13 | +?> | |
14 | +<div class="site-reset-password"> | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p>Please choose your new password:</p> | |
18 | + | |
19 | + <div class="row"> | |
20 | + <div class="col-lg-5"> | |
21 | + <?php $form = ActiveForm::begin([ 'id' => 'reset-password-form' ]); ?> | |
22 | + | |
23 | + <?= $form->field($model, 'password') | |
24 | + ->passwordInput([ 'autofocus' => true ]) ?> | |
25 | + | |
26 | + <div class="form-group"> | |
27 | + <?= Html::submitButton('Save', [ 'class' => 'btn btn-primary' ]) ?> | |
28 | + </div> | |
29 | + | |
30 | + <?php ActiveForm::end(); ?> | |
31 | + </div> | |
32 | + </div> | |
33 | +</div> | |
0 | 34 | \ No newline at end of file | ... | ... |
frontend/web/css/style.css
... | ... | @@ -4495,25 +4495,28 @@ a.list-group-item.active > .badge, |
4495 | 4495 | right: 15px; |
4496 | 4496 | } |
4497 | 4497 | |
4498 | -.radio-but{ | |
4498 | +.radio-but { | |
4499 | 4499 | padding: 5px 0 5px 38px; |
4500 | 4500 | position: relative; |
4501 | 4501 | margin: 5px 0; |
4502 | 4502 | } |
4503 | -.radio-but a:before{ | |
4504 | - content:''; | |
4505 | - position:absolute; | |
4506 | - left:0; | |
4507 | - top:0; | |
4503 | + | |
4504 | +.radio-but a:before { | |
4505 | + content: ''; | |
4506 | + position: absolute; | |
4507 | + left: 0; | |
4508 | + top: 0; | |
4508 | 4509 | width: 28px; |
4509 | - height:28px; | |
4510 | + height: 28px; | |
4510 | 4511 | background: rgb(215, 220, 222); |
4511 | 4512 | border-radius: 5px; |
4512 | 4513 | } |
4513 | -.radio-but.checked a:before{ | |
4514 | + | |
4515 | +.radio-but.checked a:before { | |
4514 | 4516 | background: rgb(26, 188, 156); |
4515 | 4517 | } |
4516 | -.radio-but.checked a:after{ | |
4518 | + | |
4519 | +.radio-but.checked a:after { | |
4517 | 4520 | content: ''; |
4518 | 4521 | position: absolute; |
4519 | 4522 | left: 0; |
... | ... | @@ -4530,7 +4533,8 @@ a.list-group-item.active > .badge, |
4530 | 4533 | font-size: 18px; |
4531 | 4534 | padding-right: 20px; |
4532 | 4535 | } |
4533 | -.reset-filters{ | |
4536 | + | |
4537 | +.reset-filters { | |
4534 | 4538 | padding: 5px 10px; |
4535 | 4539 | font-size: 12px; |
4536 | 4540 | line-height: 1.5; |
... | ... | @@ -4539,8 +4543,100 @@ a.list-group-item.active > .badge, |
4539 | 4543 | outline: none; |
4540 | 4544 | margin-bottom: 20px; |
4541 | 4545 | } |
4542 | -#cart .badge{ | |
4546 | + | |
4547 | +#cart .badge { | |
4543 | 4548 | position: absolute; |
4544 | 4549 | top: 2px; |
4545 | 4550 | right: 4px; |
4551 | +} | |
4552 | + | |
4553 | +.basket-container { | |
4554 | + position: relative; | |
4555 | +} | |
4556 | + | |
4557 | +.order-radio { | |
4558 | + height: 10px; | |
4559 | +} | |
4560 | + | |
4561 | +.loader-wrapper { | |
4562 | + background: rgba(255, 255, 255, 0.7); | |
4563 | + position: absolute; | |
4564 | + top: 0; | |
4565 | + left: 0; | |
4566 | + width: 100%; | |
4567 | + height: 100%; | |
4568 | + z-index: 2000; | |
4569 | +} | |
4570 | + | |
4571 | +.loader { | |
4572 | + display: block; | |
4573 | + position: relative; | |
4574 | + left: 50%; | |
4575 | + top: 50%; | |
4576 | + width: 150px; | |
4577 | + height: 150px; | |
4578 | + margin: -75px 0 0 -75px; | |
4579 | + border-radius: 50%; | |
4580 | + border: 3px solid transparent; | |
4581 | + border-top-color: #1980b3; | |
4582 | + z-index: 2001; | |
4583 | + | |
4584 | + -webkit-animation: spin 2s linear infinite; | |
4585 | + animation: spin 2s linear infinite; | |
4586 | +} | |
4587 | + | |
4588 | +.loader:before { | |
4589 | + content: ""; | |
4590 | + position: absolute; | |
4591 | + top: 5px; | |
4592 | + left: 5px; | |
4593 | + right: 5px; | |
4594 | + bottom: 5px; | |
4595 | + border-radius: 50%; | |
4596 | + border: 3px solid transparent; | |
4597 | + border-top-color: #3399cc; | |
4598 | + | |
4599 | + -webkit-animation: spin 3s linear infinite; | |
4600 | + animation: spin 3s linear infinite; | |
4601 | +} | |
4602 | + | |
4603 | +.loader:after { | |
4604 | + content: ""; | |
4605 | + position: absolute; | |
4606 | + top: 15px; | |
4607 | + left: 15px; | |
4608 | + right: 15px; | |
4609 | + bottom: 15px; | |
4610 | + border-radius: 50%; | |
4611 | + border: 3px solid transparent; | |
4612 | + border-top-color: #70b7da; | |
4613 | + | |
4614 | + -webkit-animation: spin 1.5s linear infinite; | |
4615 | + animation: spin 1.5s linear infinite; | |
4616 | +} | |
4617 | + | |
4618 | +@-webkit-keyframes spin { | |
4619 | + 0% { | |
4620 | + -webkit-transform: rotate(0deg); | |
4621 | + -ms-transform: rotate(0deg); | |
4622 | + transform: rotate(0deg); | |
4623 | + } | |
4624 | + 100% { | |
4625 | + -webkit-transform: rotate(360deg); | |
4626 | + -ms-transform: rotate(360deg); | |
4627 | + transform: rotate(360deg); | |
4628 | + } | |
4629 | +} | |
4630 | + | |
4631 | +@keyframes spin { | |
4632 | + 0% { | |
4633 | + -webkit-transform: rotate(0deg); | |
4634 | + -ms-transform: rotate(0deg); | |
4635 | + transform: rotate(0deg); | |
4636 | + } | |
4637 | + 100% { | |
4638 | + -webkit-transform: rotate(360deg); | |
4639 | + -ms-transform: rotate(360deg); | |
4640 | + transform: rotate(360deg); | |
4641 | + } | |
4546 | 4642 | } |
4547 | 4643 | \ No newline at end of file | ... | ... |
frontend/web/js/script.js
1 | 1 | $( |
2 | 2 | function() { |
3 | - | |
3 | + var basket = new ArtboxBasket({ | |
4 | + 'cartSelector': '#cart' | |
5 | + }); | |
4 | 6 | /** |
5 | 7 | * Modal form submit code |
6 | 8 | */ |
... | ... | @@ -52,7 +54,7 @@ $( |
52 | 54 | data: formData, |
53 | 55 | success: function(data) { |
54 | 56 | f.reset(); |
55 | - form.replaceWith(data.alert) | |
57 | + form.replaceWith(data.alert); | |
56 | 58 | }, |
57 | 59 | error: function() { |
58 | 60 | |
... | ... | @@ -103,5 +105,56 @@ $( |
103 | 105 | } |
104 | 106 | ); |
105 | 107 | } |
108 | + | |
109 | + $(document) | |
110 | + .on('click', '.add-to-basket', function(e) { | |
111 | + e.preventDefault(); | |
112 | + var id = $(this) | |
113 | + .data('id'); | |
114 | + basket.add(id, 1); | |
115 | + }); | |
116 | + | |
117 | + $(document) | |
118 | + .on('click', '.remove-product-cart', function(e) { | |
119 | + e.preventDefault(); | |
120 | + var id = $(this) | |
121 | + .parents('.product-row-basket') | |
122 | + .data('id'); | |
123 | + showLoader('#basket'); | |
124 | + var xhr = basket.remove(id); | |
125 | + xhr.done(function() { | |
126 | + $.pjax.reload({ | |
127 | + container: '#basket', | |
128 | + fragment: '#basket', | |
129 | + timeout: 5000 | |
130 | + }); | |
131 | + }) | |
132 | + }); | |
133 | + | |
134 | + $(document) | |
135 | + .on('change', '.increase-product-basket', function(e) { | |
136 | + var id = $(this) | |
137 | + .parents('.product-row-basket') | |
138 | + .data('id'); | |
139 | + showLoader('#basket'); | |
140 | + var xhr = basket.set(id, $(this) | |
141 | + .val()); | |
142 | + xhr.done(function() { | |
143 | + $.pjax.reload({ | |
144 | + container: '#basket', | |
145 | + fragment: '#basket', | |
146 | + timeout: 5000 | |
147 | + }); | |
148 | + }); | |
149 | + }); | |
150 | + | |
151 | + $(document) | |
152 | + .on('click', 'li.disabled a', function(e) { | |
153 | + e.preventDefault(); | |
154 | + }); | |
106 | 155 | } |
107 | -); | |
108 | 156 | \ No newline at end of file |
157 | +); | |
158 | +function showLoader(container) { | |
159 | + $(container) | |
160 | + .prepend('<div class="loader-wrapper"><div class="loader"></div></div>'); | |
161 | +} | |
109 | 162 | \ No newline at end of file | ... | ... |