mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Disable sorting by user-defined product category order
This commit is contained in:
committed by
Gaetan Craig-Riou
parent
3f2a5786bd
commit
2743a8183d
@@ -74,12 +74,6 @@ class ProductsRenderer
|
||||
.preferred_shopfront_producer_order
|
||||
.split(",").map { |id| "spree_products.supplier_id=#{id} DESC" }
|
||||
.join(", ") + ", spree_products.name ASC, spree_products.id ASC"
|
||||
elsif distributor.preferred_shopfront_product_sorting_method == "by_category" &&
|
||||
distributor.preferred_shopfront_taxon_order.present?
|
||||
distributor
|
||||
.preferred_shopfront_taxon_order
|
||||
.split(",").map { |id| "spree_products.primary_taxon_id=#{id} DESC" }
|
||||
.join(", ") + ", spree_products.name ASC, spree_products.id ASC"
|
||||
else
|
||||
"spree_products.name ASC, spree_products.id"
|
||||
end
|
||||
|
||||
@@ -1249,6 +1249,7 @@ en:
|
||||
open_date: "Open Date"
|
||||
close_date: "Close Date"
|
||||
display_ordering_in_shopfront: "Display ordering in shopfront:"
|
||||
shopfront_sort_by_product: "By product"
|
||||
shopfront_sort_by_category: "By category"
|
||||
shopfront_sort_by_producer: "By producer"
|
||||
shopfront_sort_by_category_placeholder: "Category"
|
||||
|
||||
@@ -280,13 +280,13 @@ module Api
|
||||
exchange.variants << product8.variants.first
|
||||
end
|
||||
|
||||
it "displays products in new order" do
|
||||
xit "displays products in new order" do
|
||||
api_get :products, id: order_cycle.id, distributor: distributor.id
|
||||
expect(product_ids).to eq [product7.id, product8.id, product2.id, product3.id, product5.id,
|
||||
product6.id, product1.id]
|
||||
end
|
||||
|
||||
it "displays products in correct order across multiple pages" do
|
||||
xit "displays products in correct order across multiple pages" do
|
||||
api_get :products, id: order_cycle.id, distributor: distributor.id, per_page: 3
|
||||
expect(product_ids).to eq [product7.id, product8.id, product2.id]
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ describe ProductsRenderer do
|
||||
end
|
||||
|
||||
describe "sorting" do
|
||||
it "sorts products by the distributor's preferred taxon list" do
|
||||
xit "sorts products by the distributor's preferred taxon list" do
|
||||
allow(distributor)
|
||||
.to receive(:preferred_shopfront_taxon_order) { "#{cakes.id},#{fruits.id}" }
|
||||
products = products_renderer.send(:products)
|
||||
@@ -106,7 +106,7 @@ describe ProductsRenderer do
|
||||
expect(products).to eq([product_apples, product_cherries])
|
||||
end
|
||||
|
||||
it "filters products with property when sorting is enabled" do
|
||||
xit "filters products with property when sorting is enabled" do
|
||||
allow(distributor).to receive(:preferred_shopfront_taxon_order) {
|
||||
"#{fruits.id},#{cakes.id}"
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ describe '
|
||||
.to eq('Enterprise "First Distributor" has been successfully updated!')
|
||||
end
|
||||
|
||||
it "sets the preference correctly" do
|
||||
xit "sets the preference correctly" do
|
||||
expect(distributor1.preferred_shopfront_product_sorting_method).to eql("by_category")
|
||||
expect(distributor1.preferred_shopfront_taxon_order).to eql(taxon.id.to_s)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user