Merge pull request #4011 from devansh-webkul/attribute_position_issue
Fixed select type attribute position is not working in layered navigation #3891
This commit is contained in:
commit
4e891b2199
|
|
@ -159,7 +159,11 @@ class CatalogRuleRepository extends Repository
|
|||
if ($attribute->code == 'tax_category_id') {
|
||||
$options = $this->getTaxCategories();
|
||||
} else {
|
||||
$options = $attribute->options;
|
||||
if ($attribute->type === 'select') {
|
||||
$options = $attribute->options()->orderBy('sort_order')->get();
|
||||
} else {
|
||||
$options = $attribute->options;
|
||||
}
|
||||
}
|
||||
|
||||
if ($attribute->validation == 'decimal')
|
||||
|
|
|
|||
|
|
@ -65,12 +65,14 @@ class Category extends TranslatableModel implements CategoryContract
|
|||
*/
|
||||
public function filterableAttributes()
|
||||
{
|
||||
return $this->belongsToMany(AttributeProxy::modelClass(), 'category_filterable_attributes')->with('options');
|
||||
return $this->belongsToMany(AttributeProxy::modelClass(), 'category_filterable_attributes')->with(['options' => function($query) {
|
||||
$query->orderBy('sort_order');
|
||||
}]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the root category of a category
|
||||
*
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function getRootCategory(): Category
|
||||
|
|
@ -124,7 +126,7 @@ class Category extends TranslatableModel implements CategoryContract
|
|||
if ($category->id === $this->id) {
|
||||
return $category;
|
||||
}
|
||||
|
||||
|
||||
return $this->findInTree($category->children);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue