diff --git a/common/components/artboximage/ArtboxImageHelper.php b/common/components/artboximage/ArtboxImageHelper.php index fada295..a379b21 100644 --- a/common/components/artboximage/ArtboxImageHelper.php +++ b/common/components/artboximage/ArtboxImageHelper.php @@ -28,7 +28,8 @@ class ArtboxImageHelper extends Object { } public static function getImage($file, $preset, $imgOptions = []) { - return Html::img(self::getImageSrc($file, $preset), $imgOptions); + $preset_alias = is_array($preset) ? array_keys($preset)[0] : null; + return Html::img(self::getImageSrc($file, $preset, $preset_alias), $imgOptions); } public static function getImageSrc($file, $preset, $preset_alias = null) { diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php index e1fb8bc..5ed9421 100755 --- a/common/modules/product/models/Product.php +++ b/common/modules/product/models/Product.php @@ -69,6 +69,7 @@ class Product extends \yii\db\ActiveRecord public function rules() { return [ + [['categories'], 'required'], [['brand_id'], 'integer'], [['name'], 'string', 'max' => 150], [['alias'], 'string', 'max' => 250], diff --git a/common/modules/product/views/manage/_form.php b/common/modules/product/views/manage/_form.php index 13cac75..0df3752 100755 --- a/common/modules/product/views/manage/_form.php +++ b/common/modules/product/views/manage/_form.php @@ -108,6 +108,14 @@ use kartik\select2\Select2; 'placeholder' => '∞' ], ], + [ + 'name' => 'image', + 'type' => MultipleInputColumn::TYPE_FILE, + 'title' => Yii::t('product', 'Image'), + 'options' => [ + 'multiple' => false + ], + ], ], ]); ?> diff --git a/common/modules/rubrication/views/tax-group/_form.php b/common/modules/rubrication/views/tax-group/_form.php index 16482b2..689d32f 100755 --- a/common/modules/rubrication/views/tax-group/_form.php +++ b/common/modules/rubrication/views/tax-group/_form.php @@ -32,7 +32,7 @@ use common\components\artboxtree\ArtboxTreeHelper; ] )->label('Use in the following categories') ?> - = $form->field($model, 'hierarchical')->checkbox() ?> + field($model, 'hierarchical')->checkbox()*/ ?> = $form->field($model, 'is_filter')->checkbox() ?> diff --git a/frontend/controllers/CatalogController.php b/frontend/controllers/CatalogController.php index 2d919ef..8b72ff1 100755 --- a/frontend/controllers/CatalogController.php +++ b/frontend/controllers/CatalogController.php @@ -86,6 +86,21 @@ class CatalogController extends \yii\web\Controller } } + if ( !empty($filter['special']) ) { + if (!is_array($filter['special'])) { + $filter['special'] = [$filter['special']]; + } + if (in_array('new', $filter['special'])) { + $params['special']['is_new'] = true; + } + if (in_array('top', $filter['special'])) { + $params['special']['is_top'] = true; + } + if (in_array('promo', $filter['special'])) { + $params['special']['akciya'] = true; + } + } + if ( !empty($filter['options']) ) { $params['options'] = $filter['options']; /*$optionQuery = TaxOption::find(); diff --git a/frontend/models/ProductFrontendSearch.php b/frontend/models/ProductFrontendSearch.php index 1ab4a0d..d4b4954 100755 --- a/frontend/models/ProductFrontendSearch.php +++ b/frontend/models/ProductFrontendSearch.php @@ -161,6 +161,11 @@ class ProductFrontendSearch extends Product { $query->andFilterWhere(['ilike', Product::tableName() .'.name', $keyword]); } } + if (!empty($params['special'])) { + foreach($params['special'] as $key => $value) { + $query->orFilterWhere([Product::tableName() .'.'. $key => $value]); + } + } if (!empty($params['brands'])) { $query->andFilterWhere([Product::tableName() .'.brand_id' => $params['brands']]); } @@ -174,6 +179,9 @@ class ProductFrontendSearch extends Product { ); } } + + + if ($setPriceLimits && !empty($params['prices'])) { if ($params['prices']['min'] > 0) { $query->andWhere(['>=', ProductVariant::tableName() .'.price', $params['prices']['min']]); diff --git a/frontend/views/catalog/products.php b/frontend/views/catalog/products.php index 0cb2121..081c65c 100755 --- a/frontend/views/catalog/products.php +++ b/frontend/views/catalog/products.php @@ -67,9 +67,38 @@ $this->registerJsFile (Yii::getAlias('@web/js/ion.rangeSlider.js'));