Commit 3ad639d1d3dee3822fa1c5f9f740ff86ffc738f7
Merge branch 'master' of gitlab.artweb.com.ua:root/new_rukzachok
Showing
11 changed files
with
100 additions
and
55 deletions
Show diff stats
.htaccess
@@ -14,7 +14,12 @@ AddDefaultCharset utf-8 | @@ -14,7 +14,12 @@ AddDefaultCharset utf-8 | ||
14 | # deal with admin first | 14 | # deal with admin first |
15 | 15 | ||
16 | 16 | ||
17 | - | 17 | + Redirect 301 /Kak_vibrat_ryuksak / |
18 | + Redirect 301 /products/ryukzaki /catalog/ryukzaki | ||
19 | + Redirect 301 /products/koshel_ki /catalog/koshelki | ||
20 | + Redirect 301 /products/nesessery /catalog/nesessery | ||
21 | + Redirect 301 /products/sumki /catalog/sumki | ||
22 | + Redirect 301 /products/germochehly /catalog/germocehly | ||
18 | 23 | ||
19 | RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] | 24 | RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] |
20 | 25 | ||
@@ -85,7 +90,6 @@ AddDefaultCharset utf-8 | @@ -85,7 +90,6 @@ AddDefaultCharset utf-8 | ||
85 | 90 | ||
86 | 91 | ||
87 | 92 | ||
88 | - | ||
89 | # RewriteCond %{HTTP_HOST} ^([^www].*)$ | 93 | # RewriteCond %{HTTP_HOST} ^([^www].*)$ |
90 | # RewriteRule ^(.*)$ http://www.%1/$1 [R=301] | 94 | # RewriteRule ^(.*)$ http://www.%1/$1 [R=301] |
91 | 95 | ||
@@ -137,7 +141,7 @@ RewriteRule ^(.*)$ $1.gz [QSA,L] | @@ -137,7 +141,7 @@ RewriteRule ^(.*)$ $1.gz [QSA,L] | ||
137 | </IfModule> | 141 | </IfModule> |
138 | # Cache-Control | 142 | # Cache-Control |
139 | <ifModule mod_headers.c> | 143 | <ifModule mod_headers.c> |
140 | - # 30 дней | 144 | +# 30 дней |
141 | <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> | 145 | <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> |
142 | Header set Cache-Control "max-age=2592000, public" | 146 | Header set Cache-Control "max-age=2592000, public" |
143 | </filesMatch> | 147 | </filesMatch> |
common/modules/product/models/Import.php
@@ -16,6 +16,7 @@ use common\modules\product\models\Product; | @@ -16,6 +16,7 @@ use common\modules\product\models\Product; | ||
16 | use common\modules\product\models\ProductVariant; | 16 | use common\modules\product\models\ProductVariant; |
17 | use common\modules\product\models\RemoteProducts; | 17 | use common\modules\product\models\RemoteProducts; |
18 | use yii\base\Model; | 18 | use yii\base\Model; |
19 | +use yii\helpers\ArrayHelper; | ||
19 | 20 | ||
20 | class Import extends Model { | 21 | class Import extends Model { |
21 | public $file; | 22 | public $file; |
@@ -119,7 +120,7 @@ class Import extends Model { | @@ -119,7 +120,7 @@ class Import extends Model { | ||
119 | } | 120 | } |
120 | 121 | ||
121 | 122 | ||
122 | - $quantity = 0; | 123 | + |
123 | 124 | ||
124 | // ===== Set stock ==== | 125 | // ===== Set stock ==== |
125 | if ( $city_name ) { | 126 | if ( $city_name ) { |
@@ -130,10 +131,29 @@ class Import extends Model { | @@ -130,10 +131,29 @@ class Import extends Model { | ||
130 | $stock->save(); | 131 | $stock->save(); |
131 | } | 132 | } |
132 | 133 | ||
133 | - $productVariant->stocks[$stock->stock_id] = $count; | ||
134 | - print_r($productVariant); | ||
135 | - die(); | ||
136 | - $quantity = $quantity + $count; | 134 | + $productStock = ProductStock::find()->where(['product_variant_id' => $productVariant->product_variant_id, 'stock_id' => $stock->stock_id])->one(); |
135 | + if(!$productStock instanceof ProductStock) { | ||
136 | + $productStock = new ProductStock; | ||
137 | + $productStock->product_variant_id = $productVariant->product_variant_id; | ||
138 | + $productStock->stock_id = $stock->stock_id; | ||
139 | + $productStock->product_id = $productVariant->product_id; | ||
140 | + } | ||
141 | + $productStock->quantity = $count; | ||
142 | + $productStock->save(); | ||
143 | + | ||
144 | + $productStocks = ProductStock::find()->where(['product_variant_id' => $productVariant->product_variant_id])->andWhere(['<>', 'stock_id', $stock->stock_id])->all(); | ||
145 | + | ||
146 | + $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; | ||
147 | + } else { | ||
148 | + | ||
149 | + $productStocks = ProductStock::find()->where(['product_variant_id' => $productVariant->product_variant_id])->all(); | ||
150 | + | ||
151 | + if($productStocks instanceof ProductStock){ | ||
152 | + $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; | ||
153 | + } else { | ||
154 | + $quantity = 0; | ||
155 | + } | ||
156 | + | ||
137 | } | 157 | } |
138 | 158 | ||
139 | if ($price_promo) { | 159 | if ($price_promo) { |
common/modules/product/models/ProductVariant.php
@@ -172,14 +172,12 @@ class ProductVariant extends \yii\db\ActiveRecord | @@ -172,14 +172,12 @@ class ProductVariant extends \yii\db\ActiveRecord | ||
172 | public function afterSave($insert, $changedAttributes) | 172 | public function afterSave($insert, $changedAttributes) |
173 | { | 173 | { |
174 | if (!is_null($this->stocks)) { | 174 | if (!is_null($this->stocks)) { |
175 | - ProductStock::deleteAll(['product_variant_id' => $this->product_variant_id]); | 175 | + //ProductStock::deleteAll(['product_variant_id' => $this->product_variant_id]); |
176 | $values = []; | 176 | $values = []; |
177 | foreach ($this->stocks as $id => $quantity) { | 177 | foreach ($this->stocks as $id => $quantity) { |
178 | - $values[] = [$this->product_id, $this->product_variant_id, $id, $quantity]; | ||
179 | - } | ||
180 | - if ($values) { | ||
181 | - self::getDb()->createCommand() | ||
182 | - ->batchInsert(ProductStock::tableName(), ['product_id', 'product_variant_id', 'stock_id', 'quantity'], $values)->execute(); | 178 | + $productStock = ProductStock::find()->where(['product_variant_id' => $this->product_variant_id, 'stock_id' => $id])->one(); |
179 | + $productStock->quantity = $quantity; | ||
180 | + $productStock->save(); | ||
183 | } | 181 | } |
184 | } | 182 | } |
185 | parent::afterSave($insert, $changedAttributes); | 183 | parent::afterSave($insert, $changedAttributes); |
common/widgets/Mailer.php
@@ -24,14 +24,24 @@ class Mailer extends Widget{ | @@ -24,14 +24,24 @@ class Mailer extends Widget{ | ||
24 | $mail = new \PHPMailer(); | 24 | $mail = new \PHPMailer(); |
25 | 25 | ||
26 | $mail->IsSMTP(); | 26 | $mail->IsSMTP(); |
27 | - | 27 | + $mail->SMTPOptions = array( |
28 | + 'ssl' => array( | ||
29 | + 'verify_peer' => false, | ||
30 | + 'verify_peer_name' => false, | ||
31 | + 'allow_self_signed' => true | ||
32 | + ) | ||
33 | + ); | ||
34 | + $mail->Host = "195.248.225.139"; | ||
35 | + $mail->SMTPDebug = true; | ||
36 | + $mail->SMTPAuth = 0; | ||
37 | + $mail->Port = 25; | ||
28 | $mail->CharSet = 'UTF-8'; | 38 | $mail->CharSet = 'UTF-8'; |
29 | - $mail->Username = "adwords@artweb.ua"; | ||
30 | - $mail->Password = "eks,ybcm5hfp"; | ||
31 | - $mail->SetFrom('dockdep@gmail.com'); | 39 | + $mail->Username = ""; |
40 | + $mail->Password = ""; | ||
41 | + $mail->SetFrom('Rukzachok.com.ua@gmail.com'); | ||
32 | $mail->Subject = $this->subject; | 42 | $mail->Subject = $this->subject; |
33 | $mail->MsgHTML($this->render($this->type, ['params' => $this->params])); | 43 | $mail->MsgHTML($this->render($this->type, ['params' => $this->params])); |
34 | - $address = "dockdep@gmail.com"; | 44 | + $address = "Rukzachok.com.ua@gmail.com"; |
35 | $mail->AddAddress($address); | 45 | $mail->AddAddress($address); |
36 | $mail->AddAddress($this->email); | 46 | $mail->AddAddress($this->email); |
37 | if(!$mail->send()) { | 47 | if(!$mail->send()) { |
frontend/config/main.php
@@ -111,6 +111,7 @@ return [ | @@ -111,6 +111,7 @@ return [ | ||
111 | 'admin/catalog/save' => 'admin/catalog/save', | 111 | 'admin/catalog/save' => 'admin/catalog/save', |
112 | 'admin/catalog/delete' => 'admin/catalog/delete', | 112 | 'admin/catalog/delete' => 'admin/catalog/delete', |
113 | 113 | ||
114 | + | ||
114 | 'thumbs/<path:.*>' => 'site/thumb', | 115 | 'thumbs/<path:.*>' => 'site/thumb', |
115 | ], | 116 | ], |
116 | 'class' => 'common\components\urlManager\LangUrlManager', | 117 | 'class' => 'common\components\urlManager\LangUrlManager', |
frontend/views/catalog/product.php
@@ -113,7 +113,9 @@ $this->registerJs (" | @@ -113,7 +113,9 @@ $this->registerJs (" | ||
113 | data-image="<?= \common\components\artboximage\ArtboxImageHelper::getImageSrc($variant->imageUrl, 'product_view') ?>" | 113 | data-image="<?= \common\components\artboximage\ArtboxImageHelper::getImageSrc($variant->imageUrl, 'product_view') ?>" |
114 | data-imageoriginal="<?= $variant->imageUrl ?>" | 114 | data-imageoriginal="<?= $variant->imageUrl ?>" |
115 | title="<?= $product->fullname ?>"> | 115 | title="<?= $product->fullname ?>"> |
116 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?> | 116 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant', ['alt' => $product->category->categoryName->value . ' ' . |
117 | + $product->fullname, 'title' => $product->category->categoryName->value . ' ' . | ||
118 | + $product->fullname])?> | ||
117 | </a> | 119 | </a> |
118 | </li> | 120 | </li> |
119 | <?php endforeach; ?> | 121 | <?php endforeach; ?> |
@@ -129,7 +131,7 @@ $this->registerJs (" | @@ -129,7 +131,7 @@ $this->registerJs (" | ||
129 | <span class="cost"><span id='cost'>0</span> <span class="valute">грн.</span></span> | 131 | <span class="cost"><span id='cost'>0</span> <span class="valute">грн.</span></span> |
130 | </div> | 132 | </div> |
131 | <input type='hidden' id='product_id'/> | 133 | <input type='hidden' id='product_id'/> |
132 | - <a href="#" rel='product' class="link_buy fl">В Корзину</a> | 134 | + <a href="#" rel='product' class="link_buy fl">Купить</a> |
133 | <div class="both"></div> | 135 | <div class="both"></div> |
134 | </div> | 136 | </div> |
135 | 137 | ||
@@ -146,7 +148,8 @@ $this->registerJs (" | @@ -146,7 +148,8 @@ $this->registerJs (" | ||
146 | <?php endif?> | 148 | <?php endif?> |
147 | </ul> | 149 | </ul> |
148 | </div> | 150 | </div> |
149 | - | 151 | + <br> |
152 | + <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,gplus,twitter" data-size="s"></div> | ||
150 | </div> | 153 | </div> |
151 | <?php /* | 154 | <?php /* |
152 | <div class="product_service"> | 155 | <div class="product_service"> |
@@ -193,13 +196,17 @@ $this->registerJs (" | @@ -193,13 +196,17 @@ $this->registerJs (" | ||
193 | <div class="content"> | 196 | <div class="content"> |
194 | <div class="pic"> | 197 | <div class="pic"> |
195 | <center> | 198 | <center> |
196 | - <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[0]->imageUrl, 'product_view',['id'=>'pic'])?></a> | 199 | + <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[0]->imageUrl, 'product_view',['id'=>'pic', 'alt' => $product->category->categoryName->value . ' ' . |
200 | + $product->fullname, 'title' => $product->category->categoryName->value . ' ' . | ||
201 | + $product->fullname])?></a> | ||
197 | </center> | 202 | </center> |
198 | </div> | 203 | </div> |
199 | <ul class="product_colors"> | 204 | <ul class="product_colors"> |
200 | <?php foreach ($product->images as $image): ?> | 205 | <?php foreach ($product->images as $image): ?> |
201 | <li><a href="<?= $image->imageUrl ?>" rel="shadowbox[gal]"> | 206 | <li><a href="<?= $image->imageUrl ?>" rel="shadowbox[gal]"> |
202 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb2')?> | 207 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb2',['alt' => $product->category->categoryName->value . ' ' . |
208 | + $product->fullname, 'title' => $product->category->categoryName->value . ' ' . | ||
209 | + $product->fullname])?> | ||
203 | </a></li> | 210 | </a></li> |
204 | <?php endforeach; ?> | 211 | <?php endforeach; ?> |
205 | </ul> | 212 | </ul> |
frontend/views/catalog/product_item.php
@@ -6,7 +6,9 @@ use yii\helpers\Url; | @@ -6,7 +6,9 @@ use yii\helpers\Url; | ||
6 | <div class="boxitem"> | 6 | <div class="boxitem"> |
7 | <div class="pixbox"> | 7 | <div class="pixbox"> |
8 | <a href="<?= Url::to(['catalog/product', 'product' => $product,'#' => 'm' .$product->enabledVariants[0]->product_variant_id]) ?>"> | 8 | <a href="<?= Url::to(['catalog/product', 'product' => $product,'#' => 'm' .$product->enabledVariants[0]->product_variant_id]) ?>"> |
9 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[0]->imageUrl, 'list')?> | 9 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[0]->imageUrl, 'list',['alt' => $product->category->categoryName->value . ' ' . |
10 | + $product->fullname, 'title' => $product->category->categoryName->value . ' ' . | ||
11 | + $product->fullname])?> | ||
10 | </a> | 12 | </a> |
11 | </div> | 13 | </div> |
12 | <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?> | 14 | <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?> |
@@ -61,7 +63,9 @@ use yii\helpers\Url; | @@ -61,7 +63,9 @@ use yii\helpers\Url; | ||
61 | 'catalog/product', | 63 | 'catalog/product', |
62 | 'product' => $product, | 64 | 'product' => $product, |
63 | '#' => 'm' . $variant->product_variant_id]) ?>"> | 65 | '#' => 'm' . $variant->product_variant_id]) ?>"> |
64 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?> | 66 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant',['alt' => $product->category->categoryName->value . ' ' . |
67 | + $product->fullname, 'title' => $product->category->categoryName->value . ' ' . | ||
68 | + $product->fullname])?> | ||
65 | </a> | 69 | </a> |
66 | </li> | 70 | </li> |
67 | <?php endif; ?> | 71 | <?php endif; ?> |
frontend/views/catalog/products.php
@@ -9,7 +9,7 @@ use yii\web\View; | @@ -9,7 +9,7 @@ use yii\web\View; | ||
9 | use common\modules\product\helpers\ProductHelper; | 9 | use common\modules\product\helpers\ProductHelper; |
10 | use frontend\widgets\Seo; | 10 | use frontend\widgets\Seo; |
11 | //$this->title = $category->categoryName->value; | 11 | //$this->title = $category->categoryName->value; |
12 | -//$this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : "Купить " . substr($category->name, 0, -2) . " в Украине недорого |" . $category->name . " доставка в Киев, Харьков, Днепропетровск, Одесса - Rukzachok.com.ua"; | 12 | +$this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : ''; |
13 | $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name; | 13 | $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name; |
14 | $this->params['seo']['seo_text'] = $category->seo_text; | 14 | $this->params['seo']['seo_text'] = $category->seo_text; |
15 | $this->params['seo']['description'] = $category->meta_desc; | 15 | $this->params['seo']['description'] = $category->meta_desc; |
frontend/views/layouts/main.php
@@ -95,6 +95,7 @@ $this->registerJsFile (Yii::$app->request->baseUrl . '/js/fix_height.js', ['posi | @@ -95,6 +95,7 @@ $this->registerJsFile (Yii::$app->request->baseUrl . '/js/fix_height.js', ['posi | ||
95 | ga('create', 'UA-75674711-1', 'auto'); | 95 | ga('create', 'UA-75674711-1', 'auto'); |
96 | ga('send', 'pageview'); | 96 | ga('send', 'pageview'); |
97 | </script> | 97 | </script> |
98 | + <meta name="google-site-verification" content="niSpd01ftupUt3pFCfQkh2zoezuPuUGblNOSGs-iRWo" /> | ||
98 | </head> | 99 | </head> |
99 | <body> | 100 | <body> |
100 | <!-- Google Tag Manager --> | 101 | <!-- Google Tag Manager --> |
frontend/views/products/show.php
@@ -115,7 +115,7 @@ use yii\widgets\Breadcrumbs; | @@ -115,7 +115,7 @@ use yii\widgets\Breadcrumbs; | ||
115 | <span class="cost"><span id='cost'>0</span> <span class="valute">грн.</span></span> | 115 | <span class="cost"><span id='cost'>0</span> <span class="valute">грн.</span></span> |
116 | </div> | 116 | </div> |
117 | <input type='hidden' id='product_id'/> | 117 | <input type='hidden' id='product_id'/> |
118 | - <a href="#" rel='product' class="link_buy fl">В Корзину</a> | 118 | + <a href="#" rel='product' class="link_buy fl">Купить</a> |
119 | <div class="both"></div> | 119 | <div class="both"></div> |
120 | </div> | 120 | </div> |
121 | 121 |
frontend/widgets/Seo.php
@@ -81,47 +81,47 @@ class Seo extends Widget | @@ -81,47 +81,47 @@ class Seo extends Widget | ||
81 | // return $filter_row; | 81 | // return $filter_row; |
82 | // } | 82 | // } |
83 | 83 | ||
84 | - if (!empty($title)) { | ||
85 | - return $title; | ||
86 | - } | 84 | + if(!empty($filter)) { |
87 | 85 | ||
88 | - $array = [ | ||
89 | - 'category' => $this->category_name | ||
90 | - ]; | 86 | + $array = [ |
87 | + 'category' => $this->category_name | ||
88 | + ]; | ||
91 | 89 | ||
92 | 90 | ||
93 | - if (isset($filter['brands']) && count($filter['brands']) == 1 ) | ||
94 | - { | ||
95 | - $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one(); | 91 | + if (isset($filter['brands']) && count($filter['brands']) == 1) { |
92 | + $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one(); | ||
96 | 93 | ||
97 | - $array['brand'] = $model->name; | ||
98 | - } | 94 | + $array['brand'] = $model->name; |
95 | + } | ||
99 | 96 | ||
100 | - if ( isset($filter['options']["pol"]) && count($filter['options']["pol"]) == 1) | ||
101 | - { | 97 | + if (isset($filter['options']["pol"]) && count($filter['options']["pol"]) == 1) { |
102 | 98 | ||
103 | - $model = TaxOption::find()->where(['alias' => $filter['options']["pol"]])->one(); | ||
104 | - $array['sex'] = $model->value->value; | 99 | + $model = TaxOption::find()->where(['alias' => $filter['options']["pol"]])->one(); |
100 | + $array['sex'] = $model->value->value; | ||
105 | 101 | ||
106 | 102 | ||
107 | - } | 103 | + } |
108 | 104 | ||
109 | - if (isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) == 1){ | 105 | + if (isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) == 1) { |
110 | 106 | ||
111 | - $model = TaxOption::find()->where(['alias' => $filter['options']["naznacenie"]])->one(); | ||
112 | - $array['naz'] = $model->value->value; | 107 | + $model = TaxOption::find()->where(['alias' => $filter['options']["naznacenie"]])->one(); |
108 | + $array['naz'] = $model->value->value; | ||
113 | 109 | ||
114 | - } | 110 | + } |
115 | 111 | ||
116 | - if (isset($filter['options']["god"]) && count($filter['options']["god"]) == 1){ | ||
117 | - $model = TaxOption::find()->where(['alias' => $filter['options']["god"]])->one(); | ||
118 | - $array['year'] = $model->value->value; | 112 | + if (isset($filter['options']["god"]) && count($filter['options']["god"]) == 1) { |
119 | 113 | ||
114 | + $model = TaxOption::find()->where(['alias' => $filter['options']["god"]])->one(); | ||
115 | + $array['year'] = $model->value->value; | ||
116 | + | ||
117 | + } | ||
118 | + return $this->getTitleString($array); | ||
119 | + | ||
120 | + } else if (!empty($title)) { | ||
121 | + return $title; | ||
122 | + } else { | ||
123 | + return $this->project_name; | ||
120 | } | 124 | } |
121 | - return $this->getTitleString($array); | ||
122 | -// else { | ||
123 | -// return $this->project_name; | ||
124 | -// } | ||
125 | 125 | ||
126 | break; | 126 | break; |
127 | case self::DESCRIPTION: | 127 | case self::DESCRIPTION: |