Commit 0bfe5701b998177935f56a4e1931455777cec0ca

Authored by Administrator
1 parent 0aaf09fd

big commti

@@ -2,8 +2,6 @@ AddDefaultCharset utf-8 @@ -2,8 +2,6 @@ AddDefaultCharset utf-8
2 <IfModule mod_rewrite.c> 2 <IfModule mod_rewrite.c>
3 3
4 4
5 - Options +FollowSymlinks  
6 -  
7 RewriteEngine On 5 RewriteEngine On
8 6
9 </IfModule> 7 </IfModule>
.htpasswd deleted
1 -root:$apr1$yVolX6PS$4ga2ZthXEzR1Ii1Ru39iX0  
2 \ No newline at end of file 0 \ No newline at end of file
common/config/main.php
@@ -8,6 +8,10 @@ return [ @@ -8,6 +8,10 @@ return [
8 // ], 8 // ],
9 ], 9 ],
10 'components' => [ 10 'components' => [
  11 + 'cache' => [
  12 + 'class' => 'yii\caching\MemCache',
  13 + 'keyPrefix' => 'linija_'
  14 + ],
11 'assetManager' => [ 15 'assetManager' => [
12 'bundles' => [ 16 'bundles' => [
13 'yii\web\JqueryAsset' =>[ 17 'yii\web\JqueryAsset' =>[
@@ -19,10 +23,6 @@ return [ @@ -19,10 +23,6 @@ return [
19 'class' => 'common\components\SmsSender', 23 'class' => 'common\components\SmsSender',
20 ], 24 ],
21 25
22 - 'cache' => [  
23 - 'class' => 'yii\caching\FileCache',  
24 - ],  
25 -  
26 'i18n' => [ 26 'i18n' => [
27 'translations' => [ 27 'translations' => [
28 '*' => [ 28 '*' => [
common/modules/product/controllers/ManageController.php
@@ -103,6 +103,7 @@ class ManageController extends Controller @@ -103,6 +103,7 @@ class ManageController extends Controller
103 { 103 {
104 $model = $this->findModel($id); 104 $model = $this->findModel($id);
105 if ($model->load(Yii::$app->request->post())) { 105 if ($model->load(Yii::$app->request->post())) {
  106 + $model->unlinkAll('options',true);
106 if ($model->save()) { 107 if ($model->save()) {
107 return $this->redirect(['view', 'id' => $model->product_id]); 108 return $this->redirect(['view', 'id' => $model->product_id]);
108 } 109 }
common/modules/product/controllers/VariantController.php
@@ -117,7 +117,7 @@ class VariantController extends Controller @@ -117,7 +117,7 @@ class VariantController extends Controller
117 { 117 {
118 $model = $this->findModel($id); 118 $model = $this->findModel($id);
119 if ($model->load(Yii::$app->request->post())) { 119 if ($model->load(Yii::$app->request->post())) {
120 - 120 + $model->unlinkAll('options',true);
121 if ($model->save()) { 121 if ($model->save()) {
122 122
123 123
common/modules/product/helpers/ProductHelper.php
@@ -250,11 +250,11 @@ @@ -250,11 +250,11 @@
250 Product::tableName() . '.product_id IN ( 250 Product::tableName() . '.product_id IN (
251 SELECT DISTINCT products 251 SELECT DISTINCT products
252 FROM ( 252 FROM (
253 - SELECT product_id AS products  
254 - FROM product_option 253 + SELECT product_id AS products FROM product WHERE product_id IN(
  254 + SELECT product_id FROM product_option
255 INNER JOIN tax_option ON tax_option.tax_option_id = product_option.option_id 255 INNER JOIN tax_option ON tax_option.tax_option_id = product_option.option_id
256 INNER JOIN tax_group ON tax_group.tax_group_id = tax_option.tax_group_id 256 INNER JOIN tax_group ON tax_group.tax_group_id = tax_option.tax_group_id
257 - WHERE tax_group.alias LIKE \''. $key .'\' AND tax_option.alias IN (\'' . implode('\',\'', $param) . '\') OR product_id IN ( 257 + WHERE tax_group.alias LIKE \''. $key .'\' AND tax_option.alias IN (\'' . implode('\',\'', $param) . '\')) OR product_id IN (
258 (SELECT product_id AS products 258 (SELECT product_id AS products
259 FROM product_variant_option 259 FROM product_variant_option
260 INNER JOIN product_variant ON product_variant_option.product_variant_id = product_variant.product_variant_id 260 INNER JOIN product_variant ON product_variant_option.product_variant_id = product_variant.product_variant_id
common/modules/product/models/Category.php
@@ -240,7 +240,7 @@ class Category extends \yii\db\ActiveRecord @@ -240,7 +240,7 @@ class Category extends \yii\db\ActiveRecord
240 ->where(['tax_option.tax_option_id'=>$query1->union($query2)]) 240 ->where(['tax_option.tax_option_id'=>$query1->union($query2)])
241 ->innerJoin('tax_group','tax_group.tax_group_id = tax_option.tax_group_id') 241 ->innerJoin('tax_group','tax_group.tax_group_id = tax_option.tax_group_id')
242 ->orderBy('tax_option.sort, tax_group.sort'); 242 ->orderBy('tax_option.sort, tax_group.sort');
243 - return $query3; 243 + return $query3->all();
244 } 244 }
245 245
246 public function getTaxGroupsForMenu() 246 public function getTaxGroupsForMenu()
console/controllers/SiteMapController.php
@@ -86,7 +86,7 @@ class SiteMapController extends Controller @@ -86,7 +86,7 @@ class SiteMapController extends Controller
86 86
87 public function getFilters($category){ 87 public function getFilters($category){
88 88
89 - return $category->getActiveFilters()->all(); 89 + return $category->getActiveFilters();
90 90
91 } 91 }
92 92
frontend/config/main.php
@@ -19,6 +19,7 @@ return [ @@ -19,6 +19,7 @@ return [
19 19
20 ], 20 ],
21 'components' => [ 21 'components' => [
  22 +
22 'authManager' => [ 23 'authManager' => [
23 'class' => 'yii\rbac\DbManager', 24 'class' => 'yii\rbac\DbManager',
24 ], 25 ],
frontend/controllers/CatalogController.php
@@ -116,9 +116,9 @@ class CatalogController extends \yii\web\Controller @@ -116,9 +116,9 @@ class CatalogController extends \yii\web\Controller
116 $brands = $brandModel->getBrands($category, $params) 116 $brands = $brandModel->getBrands($category, $params)
117 ->all(); 117 ->all();
118 118
119 - $groups = $category->getActiveFilters()->all(); 119 + $groups = $category->getActiveFilters();
120 $groups = ArrayHelper::index($groups, null, 'name'); 120 $groups = ArrayHelper::index($groups, null, 'name');
121 - //$priceLimits = $productModel->priceLimits($category, $params); 121 + $priceLimits = $productModel->priceLimits($category, $params);
122 122
123 /* 123 /*
124 * Greedy search for comments and rating 124 * Greedy search for comments and rating
@@ -142,7 +142,7 @@ class CatalogController extends \yii\web\Controller @@ -142,7 +142,7 @@ class CatalogController extends \yii\web\Controller
142 'productModel' => $productModel, 142 'productModel' => $productModel,
143 'productProvider' => $productProvider, 143 'productProvider' => $productProvider,
144 'groups' => $groups, 144 'groups' => $groups,
145 - //'priceLimits' => $priceLimits, 145 + 'priceLimits' => $priceLimits,
146 ]); 146 ]);
147 147
148 } 148 }
frontend/views/catalog/product.php
1 <?php 1 <?php
2 - 2 +/**
  3 + * @var $product Product
  4 + */
3 use common\components\artboximage\ArtboxImageHelper; 5 use common\components\artboximage\ArtboxImageHelper;
4 use common\models\Orders; 6 use common\models\Orders;
5 - use frontend\assets\FotoramaAsset; 7 +use common\modules\product\models\Product;
  8 +use frontend\assets\FotoramaAsset;
6 use frontend\widgets\Seo; 9 use frontend\widgets\Seo;
7 use common\modules\comment\widgets\CommentWidget; 10 use common\modules\comment\widgets\CommentWidget;
8 use yii\bootstrap\ActiveForm; 11 use yii\bootstrap\ActiveForm;
@@ -11,12 +14,15 @@ use yii\helpers\Url; @@ -11,12 +14,15 @@ use yii\helpers\Url;
11 use yii\widgets\MaskedInput; 14 use yii\widgets\MaskedInput;
12 use frontend\assets\FlipclockAsset; 15 use frontend\assets\FlipclockAsset;
13 FotoramaAsset::register($this); 16 FotoramaAsset::register($this);
14 -FlipclockAsset::register($this); 17 + FlipclockAsset::register($this);
  18 + $this->title = $product->name;
  19 +
  20 +
15 21
16 $this->params[ 'seo' ][ 'key' ] = $category->name; 22 $this->params[ 'seo' ][ 'key' ] = $category->name;
17 $this->params[ 'seo' ][ 'fields' ][ 'name' ] = $product->name; 23 $this->params[ 'seo' ][ 'fields' ][ 'name' ] = $product->name;
18 - $this->params[ 'seo' ][ 'h1' ] = !empty( Seo::widget([ 'row' => 'h1' ]) ) ? Seo::widget([ 'row' => 'h1' ]) : $product->name;  
19 - $this->title = $product->name; 24 + $this->params[ 'seo' ][ 'h1' ] = $product->name;
  25 +
20 26
21 $this->params[ 'breadcrumbs' ][] = [ 27 $this->params[ 'breadcrumbs' ][] = [
22 'label' => $category->name, 28 'label' => $category->name,
frontend/views/layouts/main.php
@@ -199,15 +199,24 @@ use common\models\Event; @@ -199,15 +199,24 @@ use common\models\Event;
199 <div class="clearfix"></div> 199 <div class="clearfix"></div>
200 </header> 200 </header>
201 <div id="brand_bar"> 201 <div id="brand_bar">
202 -  
203 202
204 <div class="container"> 203 <div class="container">
205 - <?= $this->render('../partial/brand_list')?> 204 + <?php if($this->beginCache('brand_list',[
  205 + 'duration' => 3600 *24
  206 + ])){ ?>
  207 +
  208 + <?= $this->render('../partial/brand_list')?>
  209 +
  210 + <?php $this->endCache(); } ?>
206 </div> 211 </div>
207 </div> 212 </div>
208 213
209 - 214 + <?php if($this->beginCache('main-menu',[
  215 + 'duration' => 3600 *24
  216 + ])){ ?>
210 <?= $this->render('main-menu') ?> 217 <?= $this->render('main-menu') ?>
  218 + <?php $this->endCache(); } ?>
  219 +
211 <div class="wrapper white"> 220 <div class="wrapper white">
212 <div class="container"> 221 <div class="container">
213 222
frontend/widgets/Seo.php
@@ -110,7 +110,8 @@ class Seo extends Widget @@ -110,7 +110,8 @@ class Seo extends Widget
110 return $default; 110 return $default;
111 111
112 112
113 - } else if(!$this->checkFilter($filter)){ 113 + } else if(!empty($filter) && !$this->checkFilter($filter)){
  114 +
114 $array = $this->arrayBuilder($filter); 115 $array = $this->arrayBuilder($filter);
115 return $this->getNameString($array); 116 return $this->getNameString($array);
116 } 117 }