mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Switching to using new prices on shop page
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
collection @products
|
||||
attributes :id, :name, :price, :permalink, :count_on_hand, :on_demand, :group_buy
|
||||
attributes :id, :name, :permalink, :count_on_hand, :on_demand, :group_buy
|
||||
node do |product|
|
||||
{notes: strip_tags(product.notes),
|
||||
description: strip_tags(product.description)}
|
||||
{
|
||||
notes: strip_tags(product.notes),
|
||||
description: strip_tags(product.description),
|
||||
price: product.master.price_with_fees(current_distributor, current_order_cycle)
|
||||
}
|
||||
end
|
||||
|
||||
child :supplier => :supplier do
|
||||
@@ -20,7 +23,12 @@ child :master => :master do
|
||||
end
|
||||
|
||||
child :variants => :variants do |variant|
|
||||
attributes :id, :is_master, :price, :count_on_hand, :options_text, :count_on_hand, :on_demand, :group_buy
|
||||
attributes :id, :is_master, :count_on_hand, :options_text, :count_on_hand, :on_demand, :group_buy
|
||||
node do |variant|
|
||||
{
|
||||
price: variant.price_with_fees(current_distributor, current_order_cycle)
|
||||
}
|
||||
end
|
||||
child :images => :images do
|
||||
attributes :id, :alt
|
||||
node do |img|
|
||||
|
||||
@@ -138,6 +138,12 @@ describe ShopController do
|
||||
response.body.should have_content "frogs"
|
||||
response.body.should_not have_content "<a href"
|
||||
end
|
||||
|
||||
it "returns price including fees" do
|
||||
Spree::Variant.any_instance.stub(:price_with_fees).and_return 998.00
|
||||
xhr :get, :products
|
||||
response.body.should have_content "998.0"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user