diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php index 3ebe8e4..d803136 100755 --- a/common/modules/product/models/Category.php +++ b/common/modules/product/models/Category.php @@ -137,6 +137,10 @@ class Category extends \yii\db\ActiveRecord return $this->hasMany(ProductCategory::className(), ['category_id' => 'category_id']); } + public function getBrands(){ + return $this->getProducts()->select('brand.*')->joinWith('brand')->groupBy('brand.brand_id'); + + } public function getTaxGroupsByLevel($level) { diff --git a/console/controllers/SiteMapController.php b/console/controllers/SiteMapController.php index 5c60336..9b72340 100644 --- a/console/controllers/SiteMapController.php +++ b/console/controllers/SiteMapController.php @@ -74,11 +74,9 @@ class SiteMapController extends Controller return Articles::find()->all(); } + public function getBrands($category){ - - public function getBrands(){ - return $this->getProducts()->select('brand.*')->joinWith('brand')->groupBy('brand.brand_id'); - + return $category->brands; } /** -- libgit2 0.21.4