我正在开发一个狂欢商务应用程序。我有产品过滤器的麻烦。我可以编辑范围过滤器,但我想添加"所有价格"过滤
以下是代码:
conds = [ [ Spree.t(:or_over_price, price: format_price(0)) , v[:amount].gteq(0)],
[ "#{format_price(25000)} - #{format_price(50000)}" , v[:amount].in(25000..50000)],
[ "#{format_price(50000)} - #{format_price(75000)}" , v[:amount].in(50000..75000)],
[ "#{format_price(75000)} - #{format_price(100000)}" , v[:amount].in(75000..100000)]]
{
因此 0或以上。但我希望将其显示为"所有价格"
我需要改变这一行,但我不知道如何:
[ Spree.t(:or_over_price, price: format_price(0)) , v[:amount].gteq(0)]
提前致谢。
答案 0 :(得分:1)
只需添加到您的config / locales / en.yml
即可 all_prices: all prices
然后在你的conds数组
conds = [ [ Spree.t(:all_prices) , v[:amount].gteq(0)],
[ "#{format_price(25000)} - #{format_price(50000)}" , v[:amount].in(25000..50000)],
[ "#{format_price(50000)} - #{format_price(75000)}" , v[:amount].in(50000..75000)],
[ "#{format_price(75000)} - #{format_price(100000)}" , v[:amount].in(75000..100000)]]
{