From 0bfe5701b998177935f56a4e1931455777cec0ca Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 26 Oct 2016 18:26:44 +0300 Subject: [PATCH] big commti --- .htaccess | 2 -- .htpasswd | 1 - common/config/main.php | 8 ++++---- common/modules/product/controllers/ManageController.php | 1 + common/modules/product/controllers/VariantController.php | 2 +- common/modules/product/helpers/ProductHelper.php | 6 +++--- common/modules/product/models/Category.php | 2 +- console/controllers/SiteMapController.php | 2 +- frontend/config/main.php | 1 + frontend/controllers/CatalogController.php | 6 +++--- frontend/views/catalog/product.php | 16 +++++++++++----- frontend/views/layouts/main.php | 15 ++++++++++++--- frontend/widgets/Seo.php | 3 ++- 13 files changed, 40 insertions(+), 25 deletions(-) delete mode 100644 .htpasswd diff --git a/.htaccess b/.htaccess index a1c59ce..0989a50 100755 --- a/.htaccess +++ b/.htaccess @@ -2,8 +2,6 @@ AddDefaultCharset utf-8 - Options +FollowSymlinks - RewriteEngine On diff --git a/.htpasswd b/.htpasswd deleted file mode 100644 index 2b049e5..0000000 --- a/.htpasswd +++ /dev/null @@ -1 +0,0 @@ -root:$apr1$yVolX6PS$4ga2ZthXEzR1Ii1Ru39iX0 \ No newline at end of file diff --git a/common/config/main.php b/common/config/main.php index 1400906..fcbc342 100755 --- a/common/config/main.php +++ b/common/config/main.php @@ -8,6 +8,10 @@ return [ // ], ], 'components' => [ + 'cache' => [ + 'class' => 'yii\caching\MemCache', + 'keyPrefix' => 'linija_' + ], 'assetManager' => [ 'bundles' => [ 'yii\web\JqueryAsset' =>[ @@ -19,10 +23,6 @@ return [ 'class' => 'common\components\SmsSender', ], - 'cache' => [ - 'class' => 'yii\caching\FileCache', - ], - 'i18n' => [ 'translations' => [ '*' => [ diff --git a/common/modules/product/controllers/ManageController.php b/common/modules/product/controllers/ManageController.php index 558d576..ae4b0fa 100755 --- a/common/modules/product/controllers/ManageController.php +++ b/common/modules/product/controllers/ManageController.php @@ -103,6 +103,7 @@ class ManageController extends Controller { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { + $model->unlinkAll('options',true); if ($model->save()) { return $this->redirect(['view', 'id' => $model->product_id]); } diff --git a/common/modules/product/controllers/VariantController.php b/common/modules/product/controllers/VariantController.php index 4d0ca7b..aebb745 100755 --- a/common/modules/product/controllers/VariantController.php +++ b/common/modules/product/controllers/VariantController.php @@ -117,7 +117,7 @@ class VariantController extends Controller { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { - + $model->unlinkAll('options',true); if ($model->save()) { diff --git a/common/modules/product/helpers/ProductHelper.php b/common/modules/product/helpers/ProductHelper.php index 36775b2..c5321d4 100755 --- a/common/modules/product/helpers/ProductHelper.php +++ b/common/modules/product/helpers/ProductHelper.php @@ -250,11 +250,11 @@ Product::tableName() . '.product_id IN ( SELECT DISTINCT products FROM ( - SELECT product_id AS products - FROM product_option + SELECT product_id AS products FROM product WHERE product_id IN( + SELECT product_id FROM product_option INNER JOIN tax_option ON tax_option.tax_option_id = product_option.option_id INNER JOIN tax_group ON tax_group.tax_group_id = tax_option.tax_group_id - WHERE tax_group.alias LIKE \''. $key .'\' AND tax_option.alias IN (\'' . implode('\',\'', $param) . '\') OR product_id IN ( + WHERE tax_group.alias LIKE \''. $key .'\' AND tax_option.alias IN (\'' . implode('\',\'', $param) . '\')) OR product_id IN ( (SELECT product_id AS products FROM product_variant_option INNER JOIN product_variant ON product_variant_option.product_variant_id = product_variant.product_variant_id diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php index 7506ea7..59211eb 100755 --- a/common/modules/product/models/Category.php +++ b/common/modules/product/models/Category.php @@ -240,7 +240,7 @@ class Category extends \yii\db\ActiveRecord ->where(['tax_option.tax_option_id'=>$query1->union($query2)]) ->innerJoin('tax_group','tax_group.tax_group_id = tax_option.tax_group_id') ->orderBy('tax_option.sort, tax_group.sort'); - return $query3; + return $query3->all(); } public function getTaxGroupsForMenu() diff --git a/console/controllers/SiteMapController.php b/console/controllers/SiteMapController.php index 08048a7..eacf262 100755 --- a/console/controllers/SiteMapController.php +++ b/console/controllers/SiteMapController.php @@ -86,7 +86,7 @@ class SiteMapController extends Controller public function getFilters($category){ - return $category->getActiveFilters()->all(); + return $category->getActiveFilters(); } diff --git a/frontend/config/main.php b/frontend/config/main.php index 259f3de..1113b03 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -19,6 +19,7 @@ return [ ], 'components' => [ + 'authManager' => [ 'class' => 'yii\rbac\DbManager', ], diff --git a/frontend/controllers/CatalogController.php b/frontend/controllers/CatalogController.php index 67a720c..de5a57a 100755 --- a/frontend/controllers/CatalogController.php +++ b/frontend/controllers/CatalogController.php @@ -116,9 +116,9 @@ class CatalogController extends \yii\web\Controller $brands = $brandModel->getBrands($category, $params) ->all(); - $groups = $category->getActiveFilters()->all(); + $groups = $category->getActiveFilters(); $groups = ArrayHelper::index($groups, null, 'name'); - //$priceLimits = $productModel->priceLimits($category, $params); + $priceLimits = $productModel->priceLimits($category, $params); /* * Greedy search for comments and rating @@ -142,7 +142,7 @@ class CatalogController extends \yii\web\Controller 'productModel' => $productModel, 'productProvider' => $productProvider, 'groups' => $groups, - //'priceLimits' => $priceLimits, + 'priceLimits' => $priceLimits, ]); } diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index bd4350b..ad4487c 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -1,8 +1,11 @@ title = $product->name; + + $this->params[ 'seo' ][ 'key' ] = $category->name; $this->params[ 'seo' ][ 'fields' ][ 'name' ] = $product->name; - $this->params[ 'seo' ][ 'h1' ] = !empty( Seo::widget([ 'row' => 'h1' ]) ) ? Seo::widget([ 'row' => 'h1' ]) : $product->name; - $this->title = $product->name; + $this->params[ 'seo' ][ 'h1' ] = $product->name; + $this->params[ 'breadcrumbs' ][] = [ 'label' => $category->name, diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 5c5ce46..126c473 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -199,15 +199,24 @@ use common\models\Event;
-
- render('../partial/brand_list')?> + beginCache('brand_list',[ + 'duration' => 3600 *24 + ])){ ?> + + render('../partial/brand_list')?> + + endCache(); } ?>
- + beginCache('main-menu',[ + 'duration' => 3600 *24 + ])){ ?> render('main-menu') ?> + endCache(); } ?> +
diff --git a/frontend/widgets/Seo.php b/frontend/widgets/Seo.php index 6dbbdbe..fbdf7b6 100755 --- a/frontend/widgets/Seo.php +++ b/frontend/widgets/Seo.php @@ -110,7 +110,8 @@ class Seo extends Widget return $default; - } else if(!$this->checkFilter($filter)){ + } else if(!empty($filter) && !$this->checkFilter($filter)){ + $array = $this->arrayBuilder($filter); return $this->getNameString($array); } -- libgit2 0.21.4