Switching to using new prices on shop page

This commit is contained in:
Will Marshall
2014-02-05 14:57:24 +11:00
parent a3e6a6253c
commit f3edd15fa7
2 changed files with 18 additions and 4 deletions

View File

@@ -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|

View File

@@ -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