CategoryFilterPanel
Cấu hình bảng lọc đặt phía trên lưới sản phẩm của trang danh mục (biến filters).
Trường
| Trường | Kiểu | Mô tả | Từ phiên bản |
|---|---|---|---|
brands |
FilterBrand[] |
Các hãng cho phép lọc; rỗng khi danh mục không cấu hình. | 1.2 |
attributes |
FilterAttribute[] |
Các nhóm thuộc tính cho phép lọc (CPU, RAM, Ổ cứng…). | 1.2 |
prices |
FilterPriceBucket[] |
Các khoảng giá đặt sẵn. | 1.2 |
Mã đầy đủ
In ra mọi trường của CategoryFilterPanel. Đổi category_filter_panel thành tên biến thật của trang bạn đang viết — xem mục Xuất hiện ở bên dưới.
{% comment %} Đối tượng CategoryFilterPanel {% endcomment %}
{% for filter_brand in category_filter_panel.brands %}
{{ filter_brand.id }}
{{ filter_brand.title }}
{{ filter_brand.slug }}
{{ filter_brand.logo_url }}
{% endfor %}
{% for filter_attribute in category_filter_panel.attributes %}
{{ filter_attribute.id }}
{{ filter_attribute.title }}
{{ filter_attribute.slug }}
{% comment %} filter_attribute.options: FilterAttributeOption[] — xem trang FilterAttributeOption {% endcomment %}
{% endfor %}
{% for filter_price_bucket in category_filter_panel.prices %}
{{ filter_price_bucket.id }}
{{ filter_price_bucket.label }}
{{ filter_price_bucket.min }}
{{ filter_price_bucket.max }}
{% endfor %}
Xuất hiện ở
Những trang dưới đây nhận sẵn một biến mang kiểu CategoryFilterPanel.
| Trang | Biến | Kiểu |
|---|---|---|
product/category |
filters |
CategoryFilterPanel |