Commit 0bfe5701b998177935f56a4e1931455777cec0ca
1 parent
0aaf09fd
big commti
Showing
13 changed files
with
40 additions
and
25 deletions
Show diff stats
.htaccess
.htpasswd deleted
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
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
frontend/config/main.php
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 | } | ... | ... |