Commit 0bfe5701b998177935f56a4e1931455777cec0ca

Authored by Administrator
1 parent 0aaf09fd

big commti

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