diff --git a/common/modules/rubrication/models/TaxOption.php b/common/modules/rubrication/models/TaxOption.php index 078e171..52a36b4 100644 --- a/common/modules/rubrication/models/TaxOption.php +++ b/common/modules/rubrication/models/TaxOption.php @@ -34,6 +34,7 @@ use yii\db\ActiveRecord; */ class TaxOption extends \yii\db\ActiveRecord { + public $_items_count; /** * @inheritdoc */ diff --git a/frontend/controllers/CatalogController.php b/frontend/controllers/CatalogController.php index e9517b9..e3dc6b3 100644 --- a/frontend/controllers/CatalogController.php +++ b/frontend/controllers/CatalogController.php @@ -74,6 +74,10 @@ class CatalogController extends \yii\web\Controller $brands_count = $brandsQuery->count(); $optionsQuery = TaxOption::find() + ->select([ + TaxOption::tableName() .'.*', + 'COUNT('. ProductOption::tableName() .'.product_id) AS _items_count' + ]) ->innerJoin(ProductOption::tableName(), ProductOption::tableName() .'.option_id='. TaxOption::tableName() .'.tax_option_id') ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() .'.product_id='. ProductOption::tableName() .'.product_id') ->where([ diff --git a/frontend/views/catalog/products.php b/frontend/views/catalog/products.php index 2ec9093..4a7c749 100644 --- a/frontend/views/catalog/products.php +++ b/frontend/views/catalog/products.php @@ -77,7 +77,7 @@ $this->params['breadcrumbs'][] = $category->name; _options as $option) :?>
- ValueRenderHTML?> + ValueRenderHTML?> (_items_count?>)
-- libgit2 0.21.4