/** * @inheritdoc */ public function setSort($value) { parent::setSort($value); if (($sort = $this->getSort()) !== false && empty($sort->attributes)) { $model = new Catalog(); foreach ($model->attributes() as $attribute) { $sort->attributes[$attribute] = ['asc' => [$attribute => SORT_ASC], 'desc' => [$attribute => SORT_DESC], 'label' => $model->getAttributeLabel($attribute)]; } foreach ($this->categoryAttributes as $attribute) { $sort->attributes[$attribute->code] = ['asc' => [$attribute->code => SORT_ASC], 'desc' => [$attribute->code => SORT_DESC], 'label' => $attribute->title]; } } }