I need a dropdown brands filter for Silvershop

How do I filter $Product on AdditionalCategories in the template?

I've tried:

$Product.filter('AdditionalCategories', $MyFilter)

But there is no AdditionalCategories column on Product in the database


Product has a many to many relationship to ProductCategory called ProductCategories .

If we want to filter products on the category relationship we would call the following:

$Product.filter('ProductCategories.ID', 5)

I would recommend writing this filter in a function in a controller. Something like this:

public function getFilteredProducts() {
    return Product::get()->filter('ProductCategories.Title', 'my-filter');
}

With the help of @3dgoo,

Looks like I needed the following:

<% loop $Products.filter('Product_ProductCategories.ProductCategoryID', $MyFilter) %>
链接地址: http://www.djcxy.com/p/96328.html

上一篇: Rails不加载可挂载引擎的js

下一篇: 我需要Silvershop的下拉品牌过滤器