Display line items in confirmation email with fees included in item totals

This commit is contained in:
Rob Harrington
2014-11-20 20:17:18 +11:00
parent b64b48f26e
commit ebaaf2a136
2 changed files with 13 additions and 2 deletions

View File

@@ -22,4 +22,14 @@ Spree::LineItem.class_eval do
joins(:product).
where('spree_products.supplier_id IN (?)', enterprises)
}
def amount_with_adjustments
# EnterpriseFee#create_locked_adjustment applies adjustments on line items to their parent order,
# so line_item.adjustments returns an empty array
amount + Spree::Adjustment.where(source_id: id).sum(&:amount)
end
def display_amount_with_adjustments
Spree::Money.new(amount_with_adjustments, { :currency => currency })
end
end

View File

@@ -10,7 +10,7 @@
%p
Thanks for shopping on
%strong= "#{Spree::Config.site_name}."
Here are your order details from
Here are the details for you order from
%strong= "#{@order.distributor.name}."
%table.column{:align => "left"}
%tr
@@ -39,7 +39,8 @@
%td{:align => "right"}
= item.quantity
%td{:align => "right"}
= item.display_amount
= item.display_amount_with_adjustments
%tr
%td{:colspan => "3"}  
%tr