Commit 9ffea88012883b371a446ad0cddc6913e0653b76

Authored by Administrator
1 parent b24bc5b0

big commti

common/modules/product/models/Category.php
@@ -137,6 +137,10 @@ class Category extends \yii\db\ActiveRecord @@ -137,6 +137,10 @@ class Category extends \yii\db\ActiveRecord
137 return $this->hasMany(ProductCategory::className(), ['category_id' => 'category_id']); 137 return $this->hasMany(ProductCategory::className(), ['category_id' => 'category_id']);
138 } 138 }
139 139
  140 + public function getBrands(){
  141 + return $this->getProducts()->select('brand.*')->joinWith('brand')->groupBy('brand.brand_id');
  142 +
  143 + }
140 144
141 public function getTaxGroupsByLevel($level) 145 public function getTaxGroupsByLevel($level)
142 { 146 {
console/controllers/SiteMapController.php
@@ -74,11 +74,9 @@ class SiteMapController extends Controller @@ -74,11 +74,9 @@ class SiteMapController extends Controller
74 return Articles::find()->all(); 74 return Articles::find()->all();
75 } 75 }
76 76
  77 + public function getBrands($category){
77 78
78 -  
79 - public function getBrands(){  
80 - return $this->getProducts()->select('brand.*')->joinWith('brand')->groupBy('brand.brand_id');  
81 - 79 + return $category->brands;
82 } 80 }
83 81
84 /** 82 /**